<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE Trustworthy #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LANGUAGE CPP, NoImplicitPrelude, MagicHash, UnboxedTuples, BangPatterns #-}</span><span>
</span><span id="line-3"></span><span class="hs-pragma">{-# OPTIONS_GHC -Wno-orphans #-}</span><span>
</span><span id="line-4"></span><span class="hs-pragma">{-# OPTIONS_HADDOCK not-home #-}</span><span>
</span><span id="line-5"></span><span>
</span><span id="line-6"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-7"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-8"></span><span class="hs-comment">-- Module      :  GHC.Real</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- Copyright   :  (c) The University of Glasgow, 1994-2002</span><span>
</span><span id="line-10"></span><span class="hs-comment">-- License     :  see libraries/base/LICENSE</span><span>
</span><span id="line-11"></span><span class="hs-comment">--</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- Maintainer  :  cvs-ghc@haskell.org</span><span>
</span><span id="line-13"></span><span class="hs-comment">-- Stability   :  internal</span><span>
</span><span id="line-14"></span><span class="hs-comment">-- Portability :  non-portable (GHC Extensions)</span><span>
</span><span id="line-15"></span><span class="hs-comment">--</span><span>
</span><span id="line-16"></span><span class="hs-comment">-- The types 'Ratio' and 'Rational', and the classes 'Real', 'Fractional',</span><span>
</span><span id="line-17"></span><span class="hs-comment">-- 'Integral', and 'RealFrac'.</span><span>
</span><span id="line-18"></span><span class="hs-comment">--</span><span>
</span><span id="line-19"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-20"></span><span>
</span><span id="line-21"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Real</span><span> </span><span class="hs-keyword">where</span><span class="hs-cpp">

#include &quot;MachDeps.h&quot;
</span><span>
</span><span id="line-25"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Base.html"><span class="hs-identifier">GHC.Base</span></a></span><span>
</span><span id="line-26"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Num.html"><span class="hs-identifier">GHC.Num</span></a></span><span>
</span><span id="line-27"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.List.html"><span class="hs-identifier">GHC.List</span></a></span><span>
</span><span id="line-28"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Enum.html"><span class="hs-identifier">GHC.Enum</span></a></span><span>
</span><span id="line-29"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Show.html"><span class="hs-identifier">GHC.Show</span></a></span><span>
</span><span id="line-30"></span><span class="hs-keyword">import</span><span> </span><span class="hs-pragma">{-# SOURCE</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="annot"><a href="GHC.Exception.html"><span class="hs-identifier">GHC.Exception</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Exception.Type.html#divZeroException"><span class="hs-identifier">divZeroException</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Exception.Type.html#overflowException"><span class="hs-identifier">overflowException</span></a></span><span>
</span><span id="line-31"></span><span>                                   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Exception.Type.html#underflowException"><span class="hs-identifier">underflowException</span></a></span><span>
</span><span id="line-32"></span><span>                                   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Exception.Type.html#ratioZeroDenomException"><span class="hs-identifier">ratioZeroDenomException</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-33"></span><span>
</span><span id="line-34"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.BigNat.html#"><span class="hs-identifier">GHC.Num.BigNat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.BigNat.html#gcdInt"><span class="hs-identifier">gcdInt</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.BigNat.html#gcdWord"><span class="hs-identifier">gcdWord</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-35"></span><span>
</span><span id="line-36"></span><span class="hs-keyword">infixr</span><span> </span><span class="hs-number">8</span><span>  </span><span class="annot"><a href="GHC.Real.html#%5E"><span class="hs-operator hs-type">^</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Real.html#%5E%5E"><span class="hs-operator hs-type">^^</span></a></span><span>
</span><span id="line-37"></span><span class="hs-keyword">infixl</span><span> </span><span class="hs-number">7</span><span>  </span><span class="annot"><a href="GHC.Real.html#%2F"><span class="hs-operator hs-type">/</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Real.html#quot"><span class="hs-operator hs-type">`quot`</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Real.html#rem"><span class="hs-operator hs-type">`rem`</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Real.html#div"><span class="hs-operator hs-type">`div`</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Real.html#mod"><span class="hs-operator hs-type">`mod`</span></a></span><span>
</span><span id="line-38"></span><span class="hs-keyword">infixl</span><span> </span><span class="hs-number">7</span><span>  </span><span class="annot"><a href="GHC.Real.html#%25"><span class="hs-operator hs-type">%</span></a></span><span>
</span><span id="line-39"></span><span>
</span><span id="line-40"></span><span class="hs-keyword">default</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>              </span><span class="hs-comment">-- Double isn't available yet,</span><span>
</span><span id="line-41"></span><span>                        </span><span class="hs-comment">-- and we shouldn't be using defaults anyway</span><span>
</span><span id="line-42"></span><span>
</span><span id="line-43"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-44"></span><span class="hs-comment">-- Divide by zero and arithmetic overflow</span><span>
</span><span id="line-45"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-46"></span><span>
</span><span id="line-47"></span><span class="hs-comment">-- We put them here because they are needed relatively early</span><span>
</span><span id="line-48"></span><span class="hs-comment">-- in the libraries before the Exception type has been defined yet.</span><span>
</span><span id="line-49"></span><span>
</span><span id="line-50"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="annot"><a href="GHC.Real.html#divZeroError"><span class="hs-pragma hs-type">divZeroError</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-51"></span><span id="local-6989586621679484143"><span class="annot"><a href="GHC.Real.html#divZeroError"><span class="hs-identifier hs-type">divZeroError</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679484143"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-52"></span><span id="divZeroError"><span class="annot"><span class="annottext">divZeroError :: forall a. a
</span><a href="GHC.Real.html#divZeroError"><span class="hs-identifier hs-var hs-var">divZeroError</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SomeException -&gt; a
forall b a. b -&gt; a
</span><a href="../../ghc-prim/src/GHC.Prim.html#raise%23"><span class="hs-identifier hs-var">raise#</span></a></span><span> </span><span class="annot"><span class="annottext">SomeException
</span><a href="GHC.Exception.Type.html#divZeroException"><span class="hs-identifier hs-var">divZeroException</span></a></span><span>
</span><span id="line-53"></span><span>
</span><span id="line-54"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="annot"><a href="GHC.Real.html#ratioZeroDenominatorError"><span class="hs-pragma hs-type">ratioZeroDenominatorError</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-55"></span><span id="local-6989586621679483954"><span class="annot"><a href="GHC.Real.html#ratioZeroDenominatorError"><span class="hs-identifier hs-type">ratioZeroDenominatorError</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679483954"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-56"></span><span id="ratioZeroDenominatorError"><span class="annot"><span class="annottext">ratioZeroDenominatorError :: forall a. a
</span><a href="GHC.Real.html#ratioZeroDenominatorError"><span class="hs-identifier hs-var hs-var">ratioZeroDenominatorError</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SomeException -&gt; a
forall b a. b -&gt; a
</span><a href="../../ghc-prim/src/GHC.Prim.html#raise%23"><span class="hs-identifier hs-var">raise#</span></a></span><span> </span><span class="annot"><span class="annottext">SomeException
</span><a href="GHC.Exception.Type.html#ratioZeroDenomException"><span class="hs-identifier hs-var">ratioZeroDenomException</span></a></span><span>
</span><span id="line-57"></span><span>
</span><span id="line-58"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="annot"><a href="GHC.Real.html#overflowError"><span class="hs-pragma hs-type">overflowError</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-59"></span><span id="local-6989586621679483952"><span class="annot"><a href="GHC.Real.html#overflowError"><span class="hs-identifier hs-type">overflowError</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679483952"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-60"></span><span id="overflowError"><span class="annot"><span class="annottext">overflowError :: forall a. a
</span><a href="GHC.Real.html#overflowError"><span class="hs-identifier hs-var hs-var">overflowError</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SomeException -&gt; a
forall b a. b -&gt; a
</span><a href="../../ghc-prim/src/GHC.Prim.html#raise%23"><span class="hs-identifier hs-var">raise#</span></a></span><span> </span><span class="annot"><span class="annottext">SomeException
</span><a href="GHC.Exception.Type.html#overflowException"><span class="hs-identifier hs-var">overflowException</span></a></span><span>
</span><span id="line-61"></span><span>
</span><span id="line-62"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="annot"><a href="GHC.Real.html#underflowError"><span class="hs-pragma hs-type">underflowError</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-63"></span><span id="local-6989586621679483950"><span class="annot"><a href="GHC.Real.html#underflowError"><span class="hs-identifier hs-type">underflowError</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679483950"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-64"></span><span id="underflowError"><span class="annot"><span class="annottext">underflowError :: forall a. a
</span><a href="GHC.Real.html#underflowError"><span class="hs-identifier hs-var hs-var">underflowError</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SomeException -&gt; a
forall b a. b -&gt; a
</span><a href="../../ghc-prim/src/GHC.Prim.html#raise%23"><span class="hs-identifier hs-var">raise#</span></a></span><span> </span><span class="annot"><span class="annottext">SomeException
</span><a href="GHC.Exception.Type.html#underflowException"><span class="hs-identifier hs-var">underflowException</span></a></span><span>
</span><span id="line-65"></span><span>
</span><span id="line-66"></span><span>
</span><span id="line-67"></span><span class="hs-comment">--------------------------------------------------------------</span><span>
</span><span id="line-68"></span><span class="hs-comment">-- The Ratio and Rational types</span><span>
</span><span id="line-69"></span><span class="hs-comment">--------------------------------------------------------------</span><span>
</span><span id="line-70"></span><span>
</span><span id="line-71"></span><span class="hs-comment">-- | Rational numbers, with numerator and denominator of some 'Integral' type.</span><span>
</span><span id="line-72"></span><span class="hs-comment">--</span><span>
</span><span id="line-73"></span><span class="hs-comment">-- Note that `Ratio`'s instances inherit the deficiencies from the type</span><span>
</span><span id="line-74"></span><span class="hs-comment">-- parameter's. For example, @Ratio Natural@'s 'Num' instance has similar</span><span>
</span><span id="line-75"></span><span class="hs-comment">-- problems to `Numeric.Natural.Natural`'s.</span><span>
</span><span id="line-76"></span><span class="hs-keyword">data</span><span>  </span><span id="Ratio"><span class="annot"><a href="GHC.Real.html#Ratio"><span class="hs-identifier hs-var">Ratio</span></a></span></span><span> </span><span id="local-6989586621679484133"><span class="annot"><a href="#local-6989586621679484133"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="#local-6989586621679484133"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span id="%3A%25"><span class="annot"><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-var">:%</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="#local-6989586621679484133"><span class="hs-identifier hs-type">a</span></a></span><span>  </span><span class="hs-keyword">deriving</span><span> </span><span id="local-6989586621679483944"><span id="local-6989586621679483948"><span class="annot"><span class="annottext">Ratio a -&gt; Ratio a -&gt; Bool
(Ratio a -&gt; Ratio a -&gt; Bool)
-&gt; (Ratio a -&gt; Ratio a -&gt; Bool) -&gt; Eq (Ratio a)
forall a. Eq a =&gt; Ratio a -&gt; Ratio a -&gt; Bool
forall a. (a -&gt; a -&gt; Bool) -&gt; (a -&gt; a -&gt; Bool) -&gt; Eq a
/= :: Ratio a -&gt; Ratio a -&gt; Bool
$c/= :: forall a. Eq a =&gt; Ratio a -&gt; Ratio a -&gt; Bool
== :: Ratio a -&gt; Ratio a -&gt; Bool
$c== :: forall a. Eq a =&gt; Ratio a -&gt; Ratio a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#Eq"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var">Eq</span></a></span></span></span><span> </span><span class="hs-comment">-- ^ @since 2.01</span><span>
</span><span id="line-77"></span><span>
</span><span id="line-78"></span><span class="hs-comment">-- | Arbitrary-precision rational numbers, represented as a ratio of</span><span>
</span><span id="line-79"></span><span class="hs-comment">-- two 'Integer' values.  A rational number may be constructed using</span><span>
</span><span id="line-80"></span><span class="hs-comment">-- the '%' operator.</span><span>
</span><span id="line-81"></span><span class="hs-keyword">type</span><span>  </span><span id="Rational"><span class="annot"><a href="GHC.Real.html#Rational"><span class="hs-identifier hs-var">Rational</span></a></span></span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><a href="GHC.Real.html#Ratio"><span class="hs-identifier hs-type">Ratio</span></a></span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-identifier hs-type">Integer</span></a></span><span>
</span><span id="line-82"></span><span>
</span><span id="line-83"></span><span class="annot"><a href="GHC.Real.html#ratioPrec"><span class="hs-identifier hs-type">ratioPrec</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Real.html#ratioPrec1"><span class="hs-identifier hs-type">ratioPrec1</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-84"></span><span id="ratioPrec"><span class="annot"><span class="annottext">ratioPrec :: Int
</span><a href="GHC.Real.html#ratioPrec"><span class="hs-identifier hs-var hs-var">ratioPrec</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">7</span></span><span>  </span><span class="hs-comment">-- Precedence of ':%' constructor</span><span>
</span><span id="line-85"></span><span id="ratioPrec1"><span class="annot"><span class="annottext">ratioPrec1 :: Int
</span><a href="GHC.Real.html#ratioPrec1"><span class="hs-identifier hs-var hs-var">ratioPrec1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="GHC.Real.html#ratioPrec"><span class="hs-identifier hs-var">ratioPrec</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span>
</span><span id="line-86"></span><span>
</span><span id="line-87"></span><span class="annot"><a href="GHC.Real.html#infinity"><span class="hs-identifier hs-type">infinity</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Real.html#notANumber"><span class="hs-identifier hs-type">notANumber</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Real.html#Rational"><span class="hs-identifier hs-type">Rational</span></a></span><span>
</span><span id="line-88"></span><span id="infinity"><span class="annot"><span class="annottext">infinity :: Rational
</span><a href="GHC.Real.html#infinity"><span class="hs-identifier hs-var hs-var">infinity</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Rational
forall a. a -&gt; a -&gt; Ratio a
</span><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-var">:%</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">0</span></span><span>
</span><span id="line-89"></span><span id="notANumber"><span class="annot"><span class="annottext">notANumber :: Rational
</span><a href="GHC.Real.html#notANumber"><span class="hs-identifier hs-var hs-var">notANumber</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Rational
forall a. a -&gt; a -&gt; Ratio a
</span><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-var">:%</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">0</span></span><span>
</span><span id="line-90"></span><span>
</span><span id="line-91"></span><span class="hs-comment">-- Use :%, not % for Inf/NaN; the latter would</span><span>
</span><span id="line-92"></span><span class="hs-comment">-- immediately lead to a runtime error, because it normalises.</span><span>
</span><span id="line-93"></span><span>
</span><span id="line-94"></span><span class="hs-comment">-- | Forms the ratio of two integral numbers.</span><span>
</span><span id="line-95"></span><span class="hs-pragma">{-# SPECIALISE</span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">%</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-pragma hs-type">Integer</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-pragma hs-type">Integer</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="GHC.Real.html#Rational"><span class="hs-pragma hs-type">Rational</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-96"></span><span id="local-6989586621679483937"><span class="annot"><a href="GHC.Real.html#%25"><span class="hs-operator hs-type">(%)</span></a></span><span>                     </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Real.html#Integral"><span class="hs-identifier hs-type">Integral</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679483937"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679483937"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679483937"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Real.html#Ratio"><span class="hs-identifier hs-type">Ratio</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679483937"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-97"></span><span>
</span><span id="line-98"></span><span class="hs-comment">-- | Extract the numerator of the ratio in reduced form:</span><span>
</span><span id="line-99"></span><span class="hs-comment">-- the numerator and denominator have no common factor and the denominator</span><span>
</span><span id="line-100"></span><span class="hs-comment">-- is positive.</span><span>
</span><span id="line-101"></span><span id="local-6989586621679484125"><span class="annot"><a href="GHC.Real.html#numerator"><span class="hs-identifier hs-type">numerator</span></a></span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Real.html#Ratio"><span class="hs-identifier hs-type">Ratio</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484125"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484125"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-102"></span><span>
</span><span id="line-103"></span><span class="hs-comment">-- | Extract the denominator of the ratio in reduced form:</span><span>
</span><span id="line-104"></span><span class="hs-comment">-- the numerator and denominator have no common factor and the denominator</span><span>
</span><span id="line-105"></span><span class="hs-comment">-- is positive.</span><span>
</span><span id="line-106"></span><span id="local-6989586621679483935"><span class="annot"><a href="GHC.Real.html#denominator"><span class="hs-identifier hs-type">denominator</span></a></span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Real.html#Ratio"><span class="hs-identifier hs-type">Ratio</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679483935"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679483935"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-107"></span><span>
</span><span id="line-108"></span><span>
</span><span id="line-109"></span><span class="hs-comment">-- | 'reduce' is a subsidiary function used only in this module.</span><span>
</span><span id="line-110"></span><span class="hs-comment">-- It normalises a ratio by dividing both numerator and denominator by</span><span>
</span><span id="line-111"></span><span class="hs-comment">-- their greatest common divisor.</span><span>
</span><span id="line-112"></span><span id="local-6989586621679484131"><span class="annot"><a href="GHC.Real.html#reduce"><span class="hs-identifier hs-type">reduce</span></a></span><span> </span><span class="hs-glyph">::</span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Real.html#Integral"><span class="hs-identifier hs-type">Integral</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484131"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484131"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484131"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Real.html#Ratio"><span class="hs-identifier hs-type">Ratio</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484131"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-113"></span><span class="hs-pragma">{-# SPECIALISE</span><span> </span><span class="annot"><a href="GHC.Real.html#reduce"><span class="hs-pragma hs-type">reduce</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-pragma hs-type">Integer</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-pragma hs-type">Integer</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="GHC.Real.html#Rational"><span class="hs-pragma hs-type">Rational</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-114"></span><span id="reduce"><span class="annot"><span class="annottext">reduce :: forall a. Integral a =&gt; a -&gt; a -&gt; Ratio a
</span><a href="GHC.Real.html#reduce"><span class="hs-identifier hs-var hs-var">reduce</span></a></span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">0</span></span><span>              </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Ratio a
forall a. a
</span><a href="GHC.Real.html#ratioZeroDenominatorError"><span class="hs-identifier hs-var">ratioZeroDenominatorError</span></a></span><span>
</span><span id="line-115"></span><span class="annot"><a href="GHC.Real.html#reduce"><span class="hs-identifier hs-var">reduce</span></a></span><span> </span><span id="local-6989586621679483923"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483923"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679483922"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483922"><span class="hs-identifier hs-var">y</span></a></span></span><span>              </span><span class="hs-glyph">=</span><span>  </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483923"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Real.html#quot"><span class="hs-operator hs-var">`quot`</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483921"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Ratio a
forall a. a -&gt; a -&gt; Ratio a
</span><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-var">:%</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483922"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Real.html#quot"><span class="hs-operator hs-var">`quot`</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483921"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-116"></span><span>                           </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679483921"><span class="annot"><span class="annottext">d :: a
</span><a href="#local-6989586621679483921"><span class="hs-identifier hs-var hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Real.html#gcd"><span class="hs-identifier hs-var">gcd</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483923"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483922"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-117"></span><span>
</span><span id="line-118"></span><span id="local-6989586621679483911"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483911"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="%25"><span class="annot"><span class="annottext">% :: forall a. Integral a =&gt; a -&gt; a -&gt; Ratio a
</span><a href="GHC.Real.html#%25"><span class="hs-operator hs-var hs-var">%</span></a></span></span><span> </span><span id="local-6989586621679483910"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483910"><span class="hs-identifier hs-var">y</span></a></span></span><span>                   </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Ratio a
forall a. Integral a =&gt; a -&gt; a -&gt; Ratio a
</span><a href="GHC.Real.html#reduce"><span class="hs-identifier hs-var">reduce</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483911"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a
forall a. Num a =&gt; a -&gt; a
</span><a href="GHC.Num.html#signum"><span class="hs-identifier hs-var">signum</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483910"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; a
forall a. Num a =&gt; a -&gt; a
</span><a href="GHC.Num.html#abs"><span class="hs-identifier hs-var">abs</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483910"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-119"></span><span>
</span><span id="line-120"></span><span id="numerator"><span class="annot"><span class="annottext">numerator :: forall a. Ratio a -&gt; a
</span><a href="GHC.Real.html#numerator"><span class="hs-identifier hs-var hs-var">numerator</span></a></span></span><span>   </span><span class="hs-special">(</span><span id="local-6989586621679483906"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483906"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-type">:%</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483906"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-121"></span><span id="denominator"><span class="annot"><span class="annottext">denominator :: forall a. Ratio a -&gt; a
</span><a href="GHC.Real.html#denominator"><span class="hs-identifier hs-var hs-var">denominator</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-type">:%</span></a></span><span> </span><span id="local-6989586621679483905"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483905"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483905"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-122"></span><span>
</span><span id="line-123"></span><span class="hs-comment">--------------------------------------------------------------</span><span>
</span><span id="line-124"></span><span class="hs-comment">-- Standard numeric classes</span><span>
</span><span id="line-125"></span><span class="hs-comment">--------------------------------------------------------------</span><span>
</span><span id="line-126"></span><span>
</span><span id="line-127"></span><span class="hs-keyword">class</span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Num.html#Num"><span class="hs-identifier hs-type">Num</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484127"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#Ord"><span class="hs-identifier hs-type">Ord</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484127"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span id="Real"><span class="annot"><a href="GHC.Real.html#Real"><span class="hs-identifier hs-var">Real</span></a></span></span><span> </span><span id="local-6989586621679484127"><span class="annot"><a href="#local-6989586621679484127"><span class="hs-identifier hs-type">a</span></a></span></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-128"></span><span>    </span><span class="hs-comment">-- | the rational equivalent of its real argument with full precision</span><span>
</span><span id="line-129"></span><span>    </span><span id="toRational"><span class="annot"><a href="GHC.Real.html#toRational"><span class="hs-identifier hs-type">toRational</span></a></span></span><span>          </span><span class="hs-glyph">::</span><span>  </span><span class="annot"><a href="#local-6989586621679484127"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Real.html#Rational"><span class="hs-identifier hs-type">Rational</span></a></span><span>
</span><span id="line-130"></span><span>
</span><span id="line-131"></span><span class="hs-comment">-- | Integral numbers, supporting integer division.</span><span>
</span><span id="line-132"></span><span class="hs-comment">--</span><span>
</span><span id="line-133"></span><span class="hs-comment">-- The Haskell Report defines no laws for 'Integral'. However, 'Integral'</span><span>
</span><span id="line-134"></span><span class="hs-comment">-- instances are customarily expected to define a Euclidean domain and have the</span><span>
</span><span id="line-135"></span><span class="hs-comment">-- following properties for the 'div'\/'mod' and 'quot'\/'rem' pairs, given</span><span>
</span><span id="line-136"></span><span class="hs-comment">-- suitable Euclidean functions @f@ and @g@:</span><span>
</span><span id="line-137"></span><span class="hs-comment">--</span><span>
</span><span id="line-138"></span><span class="hs-comment">-- * @x@ = @y * quot x y + rem x y@ with @rem x y@ = @fromInteger 0@ or</span><span>
</span><span id="line-139"></span><span class="hs-comment">-- @g (rem x y)@ &lt; @g y@</span><span>
</span><span id="line-140"></span><span class="hs-comment">-- * @x@ = @y * div x y + mod x y@ with @mod x y@ = @fromInteger 0@ or</span><span>
</span><span id="line-141"></span><span class="hs-comment">-- @f (mod x y)@ &lt; @f y@</span><span>
</span><span id="line-142"></span><span class="hs-comment">--</span><span>
</span><span id="line-143"></span><span class="hs-comment">-- An example of a suitable Euclidean function, for 'Integer'\'s instance, is</span><span>
</span><span id="line-144"></span><span class="hs-comment">-- 'abs'.</span><span>
</span><span id="line-145"></span><span class="hs-keyword">class</span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Real.html#Real"><span class="hs-identifier hs-type">Real</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484128"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Enum.html#Enum"><span class="hs-identifier hs-type">Enum</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484128"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span id="Integral"><span class="annot"><a href="GHC.Real.html#Integral"><span class="hs-identifier hs-var">Integral</span></a></span></span><span> </span><span id="local-6989586621679484128"><span class="annot"><a href="#local-6989586621679484128"><span class="hs-identifier hs-type">a</span></a></span></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-146"></span><span>    </span><span class="hs-comment">-- | integer division truncated toward zero</span><span>
</span><span id="line-147"></span><span>    </span><span id="quot"><span class="annot"><a href="GHC.Real.html#quot"><span class="hs-identifier hs-type">quot</span></a></span></span><span>                </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679484128"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484128"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484128"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-148"></span><span>    </span><span class="hs-comment">-- | integer remainder, satisfying</span><span>
</span><span id="line-149"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-150"></span><span>    </span><span class="hs-comment">-- &gt; (x `quot` y)*y + (x `rem` y) == x</span><span>
</span><span id="line-151"></span><span>    </span><span id="rem"><span class="annot"><a href="GHC.Real.html#rem"><span class="hs-identifier hs-type">rem</span></a></span></span><span>                 </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679484128"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484128"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484128"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-152"></span><span>    </span><span class="hs-comment">-- | integer division truncated toward negative infinity</span><span>
</span><span id="line-153"></span><span>    </span><span id="div"><span class="annot"><a href="GHC.Real.html#div"><span class="hs-identifier hs-type">div</span></a></span></span><span>                 </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679484128"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484128"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484128"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-154"></span><span>    </span><span class="hs-comment">-- | integer modulus, satisfying</span><span>
</span><span id="line-155"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-156"></span><span>    </span><span class="hs-comment">-- &gt; (x `div` y)*y + (x `mod` y) == x</span><span>
</span><span id="line-157"></span><span>    </span><span id="mod"><span class="annot"><a href="GHC.Real.html#mod"><span class="hs-identifier hs-type">mod</span></a></span></span><span>                 </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679484128"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484128"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484128"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-158"></span><span>    </span><span class="hs-comment">-- | simultaneous 'quot' and 'rem'</span><span>
</span><span id="line-159"></span><span>    </span><span id="quotRem"><span class="annot"><a href="GHC.Real.html#quotRem"><span class="hs-identifier hs-type">quotRem</span></a></span></span><span>             </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679484128"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484128"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679484128"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679484128"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-160"></span><span>    </span><span class="hs-comment">-- | simultaneous 'div' and 'mod'</span><span>
</span><span id="line-161"></span><span>    </span><span id="divMod"><span class="annot"><a href="GHC.Real.html#divMod"><span class="hs-identifier hs-type">divMod</span></a></span></span><span>              </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679484128"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484128"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679484128"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679484128"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-162"></span><span>    </span><span class="hs-comment">-- | conversion to 'Integer'</span><span>
</span><span id="line-163"></span><span>    </span><span id="toInteger"><span class="annot"><a href="GHC.Real.html#toInteger"><span class="hs-identifier hs-type">toInteger</span></a></span></span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679484128"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-identifier hs-type">Integer</span></a></span><span>
</span><span id="line-164"></span><span>
</span><span id="line-165"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Real.html#quot"><span class="hs-pragma hs-type">quot</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-166"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Real.html#rem"><span class="hs-pragma hs-type">rem</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-167"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Real.html#div"><span class="hs-pragma hs-type">div</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-168"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Real.html#mod"><span class="hs-pragma hs-type">mod</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-169"></span><span>    </span><span id="local-6989586621679483900"><span id="local-6989586621679483899"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483899"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="annot"><a href="GHC.Real.html#quot"><span class="hs-operator hs-var hs-var">`quot`</span></a></span><span> </span><span id="local-6989586621679483898"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483898"><span class="hs-identifier hs-var">d</span></a></span></span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483897"><span class="hs-identifier hs-var">q</span></a></span><span>  </span><span class="hs-keyword">where</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679483897"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483897"><span class="hs-identifier hs-var">q</span></a></span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; (a, a)
forall a. Integral a =&gt; a -&gt; a -&gt; (a, a)
</span><a href="GHC.Real.html#quotRem"><span class="hs-identifier hs-var">quotRem</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483899"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483898"><span class="hs-identifier hs-var">d</span></a></span></span><span>
</span><span id="line-170"></span><span>    </span><span id="local-6989586621679483895"><span id="local-6989586621679483894"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483894"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="annot"><a href="GHC.Real.html#rem"><span class="hs-operator hs-var hs-var">`rem`</span></a></span><span> </span><span id="local-6989586621679483893"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483893"><span class="hs-identifier hs-var">d</span></a></span></span><span>           </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483892"><span class="hs-identifier hs-var">r</span></a></span><span>  </span><span class="hs-keyword">where</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span id="local-6989586621679483892"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483892"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; (a, a)
forall a. Integral a =&gt; a -&gt; a -&gt; (a, a)
</span><a href="GHC.Real.html#quotRem"><span class="hs-identifier hs-var">quotRem</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483894"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483893"><span class="hs-identifier hs-var">d</span></a></span></span><span>
</span><span id="line-171"></span><span>    </span><span id="local-6989586621679483890"><span id="local-6989586621679483889"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483889"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="annot"><a href="GHC.Real.html#div"><span class="hs-operator hs-var hs-var">`div`</span></a></span><span> </span><span id="local-6989586621679483888"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483888"><span class="hs-identifier hs-var">d</span></a></span></span><span>           </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483887"><span class="hs-identifier hs-var">q</span></a></span><span>  </span><span class="hs-keyword">where</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679483887"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483887"><span class="hs-identifier hs-var">q</span></a></span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; (a, a)
forall a. Integral a =&gt; a -&gt; a -&gt; (a, a)
</span><a href="GHC.Real.html#divMod"><span class="hs-identifier hs-var">divMod</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483889"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483888"><span class="hs-identifier hs-var">d</span></a></span></span><span>
</span><span id="line-172"></span><span>    </span><span id="local-6989586621679483885"><span id="local-6989586621679483884"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483884"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="annot"><a href="GHC.Real.html#mod"><span class="hs-operator hs-var hs-var">`mod`</span></a></span><span> </span><span id="local-6989586621679483883"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483883"><span class="hs-identifier hs-var">d</span></a></span></span><span>           </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483882"><span class="hs-identifier hs-var">r</span></a></span><span>  </span><span class="hs-keyword">where</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span id="local-6989586621679483882"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483882"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; (a, a)
forall a. Integral a =&gt; a -&gt; a -&gt; (a, a)
</span><a href="GHC.Real.html#divMod"><span class="hs-identifier hs-var">divMod</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483884"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483883"><span class="hs-identifier hs-var">d</span></a></span></span><span>
</span><span id="line-173"></span><span>
</span><span id="line-174"></span><span>    </span><span id="local-6989586621679483880"><span class="annot"><a href="GHC.Real.html#divMod"><span class="hs-identifier hs-var hs-var">divMod</span></a></span><span> </span><span id="local-6989586621679483868"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483868"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679483867"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483867"><span class="hs-identifier hs-var">d</span></a></span></span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">a -&gt; a
forall a. Num a =&gt; a -&gt; a
</span><a href="GHC.Num.html#signum"><span class="hs-identifier hs-var">signum</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483866"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a
forall a. Num a =&gt; a -&gt; a
</span><a href="GHC.Num.html#negate"><span class="hs-identifier hs-var">negate</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; a
forall a. Num a =&gt; a -&gt; a
</span><a href="GHC.Num.html#signum"><span class="hs-identifier hs-var">signum</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483867"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">then</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483865"><span class="hs-identifier hs-var">q</span></a></span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">a
</span><span class="hs-number">1</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483866"><span class="hs-identifier hs-var">r</span></a></span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483867"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">(a, a)
</span><a href="#local-6989586621679483864"><span class="hs-identifier hs-var">qr</span></a></span><span>
</span><span id="line-175"></span><span>                           </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679483864"><span class="annot"><span class="annottext">qr :: (a, a)
</span><a href="#local-6989586621679483864"><span class="hs-identifier hs-var">qr</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span id="local-6989586621679483865"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483865"><span class="hs-identifier hs-var">q</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679483866"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483866"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; (a, a)
forall a. Integral a =&gt; a -&gt; a -&gt; (a, a)
</span><a href="GHC.Real.html#quotRem"><span class="hs-identifier hs-var">quotRem</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483868"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483867"><span class="hs-identifier hs-var">d</span></a></span></span><span>
</span><span id="line-176"></span><span>
</span><span id="line-177"></span><span class="hs-comment">-- | Fractional numbers, supporting real division.</span><span>
</span><span id="line-178"></span><span class="hs-comment">--</span><span>
</span><span id="line-179"></span><span class="hs-comment">-- The Haskell Report defines no laws for 'Fractional'. However, @('+')@ and</span><span>
</span><span id="line-180"></span><span class="hs-comment">-- @('*')@ are customarily expected to define a division ring and have the</span><span>
</span><span id="line-181"></span><span class="hs-comment">-- following properties:</span><span>
</span><span id="line-182"></span><span class="hs-comment">--</span><span>
</span><span id="line-183"></span><span class="hs-comment">-- [__'recip' gives the multiplicative inverse__]:</span><span>
</span><span id="line-184"></span><span class="hs-comment">-- @x * recip x@ = @recip x * x@ = @fromInteger 1@</span><span>
</span><span id="line-185"></span><span class="hs-comment">--</span><span>
</span><span id="line-186"></span><span class="hs-comment">-- Note that it /isn't/ customarily expected that a type instance of</span><span>
</span><span id="line-187"></span><span class="hs-comment">-- 'Fractional' implement a field. However, all instances in @base@ do.</span><span>
</span><span id="line-188"></span><span class="hs-keyword">class</span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Num.html#Num"><span class="hs-identifier hs-type">Num</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484122"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span id="Fractional"><span class="annot"><a href="GHC.Real.html#Fractional"><span class="hs-identifier hs-var">Fractional</span></a></span></span><span> </span><span id="local-6989586621679484122"><span class="annot"><a href="#local-6989586621679484122"><span class="hs-identifier hs-type">a</span></a></span></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-189"></span><span>    </span><span class="hs-pragma">{-# MINIMAL</span><span> </span><span class="annot"><a href="GHC.Real.html#fromRational"><span class="hs-pragma hs-type">fromRational</span></a></span><span class="hs-pragma">,</span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.Real.html#recip"><span class="hs-pragma hs-type">recip</span></a></span><span> </span><span class="hs-pragma">|</span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">/</span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-190"></span><span>
</span><span id="line-191"></span><span>    </span><span class="hs-comment">-- | Fractional division.</span><span>
</span><span id="line-192"></span><span>    </span><span id="%2F"><span class="annot"><a href="GHC.Real.html#%2F"><span class="hs-operator hs-type">(/)</span></a></span></span><span>                 </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679484122"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484122"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484122"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-193"></span><span>    </span><span class="hs-comment">-- | Reciprocal fraction.</span><span>
</span><span id="line-194"></span><span>    </span><span id="recip"><span class="annot"><a href="GHC.Real.html#recip"><span class="hs-identifier hs-type">recip</span></a></span></span><span>               </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679484122"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484122"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-195"></span><span>    </span><span class="hs-comment">-- | Conversion from a 'Rational' (that is @'Ratio' 'Integer'@).</span><span>
</span><span id="line-196"></span><span>    </span><span class="hs-comment">-- A floating literal stands for an application of 'fromRational'</span><span>
</span><span id="line-197"></span><span>    </span><span class="hs-comment">-- to a value of type 'Rational', so such literals have type</span><span>
</span><span id="line-198"></span><span>    </span><span class="hs-comment">-- @('Fractional' a) =&gt; a@.</span><span>
</span><span id="line-199"></span><span>    </span><span id="fromRational"><span class="annot"><a href="GHC.Real.html#fromRational"><span class="hs-identifier hs-type">fromRational</span></a></span></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Real.html#Rational"><span class="hs-identifier hs-type">Rational</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484122"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-200"></span><span>
</span><span id="line-201"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Real.html#recip"><span class="hs-pragma hs-type">recip</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-202"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">/</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-203"></span><span>    </span><span id="local-6989586621679483859"><span class="annot"><a href="GHC.Real.html#recip"><span class="hs-identifier hs-var hs-var">recip</span></a></span><span> </span><span id="local-6989586621679483855"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483855"><span class="hs-identifier hs-var">x</span></a></span></span><span>             </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Fractional a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Real.html#%2F"><span class="hs-operator hs-var">/</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483855"><span class="hs-identifier hs-var">x</span></a></span></span><span>
</span><span id="line-204"></span><span>    </span><span id="local-6989586621679483854"><span id="local-6989586621679483850"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483850"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><a href="GHC.Real.html#%2F"><span class="hs-operator hs-var hs-var">/</span></a></span><span> </span><span id="local-6989586621679483849"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483849"><span class="hs-identifier hs-var">y</span></a></span></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483850"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a
forall a. Fractional a =&gt; a -&gt; a
</span><a href="GHC.Real.html#recip"><span class="hs-identifier hs-var">recip</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483849"><span class="hs-identifier hs-var">y</span></a></span></span><span>
</span><span id="line-205"></span><span>
</span><span id="line-206"></span><span class="hs-comment">-- | Extracting components of fractions.</span><span>
</span><span id="line-207"></span><span class="hs-keyword">class</span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Real.html#Real"><span class="hs-identifier hs-type">Real</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484121"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Real.html#Fractional"><span class="hs-identifier hs-type">Fractional</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484121"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span id="RealFrac"><span class="annot"><a href="GHC.Real.html#RealFrac"><span class="hs-identifier hs-var">RealFrac</span></a></span></span><span> </span><span id="local-6989586621679484121"><span class="annot"><a href="#local-6989586621679484121"><span class="hs-identifier hs-type">a</span></a></span></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-208"></span><span>    </span><span class="hs-comment">-- | The function 'properFraction' takes a real fractional number @x@</span><span>
</span><span id="line-209"></span><span>    </span><span class="hs-comment">-- and returns a pair @(n,f)@ such that @x = n+f@, and:</span><span>
</span><span id="line-210"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-211"></span><span>    </span><span class="hs-comment">-- * @n@ is an integral number with the same sign as @x@; and</span><span>
</span><span id="line-212"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-213"></span><span>    </span><span class="hs-comment">-- * @f@ is a fraction with the same type and sign as @x@,</span><span>
</span><span id="line-214"></span><span>    </span><span class="hs-comment">--   and with absolute value less than @1@.</span><span>
</span><span id="line-215"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-216"></span><span>    </span><span class="hs-comment">-- The default definitions of the 'ceiling', 'floor', 'truncate'</span><span>
</span><span id="line-217"></span><span>    </span><span class="hs-comment">-- and 'round' functions are in terms of 'properFraction'.</span><span>
</span><span id="line-218"></span><span>    </span><span id="local-6989586621679484118"><span id="properFraction"><span class="annot"><a href="GHC.Real.html#properFraction"><span class="hs-identifier hs-type">properFraction</span></a></span></span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Real.html#Integral"><span class="hs-identifier hs-type">Integral</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484118"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484121"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679484118"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679484121"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-219"></span><span>    </span><span class="hs-comment">-- | @'truncate' x@ returns the integer nearest @x@ between zero and @x@</span><span>
</span><span id="line-220"></span><span>    </span><span id="local-6989586621679484120"><span id="truncate"><span class="annot"><a href="GHC.Real.html#truncate"><span class="hs-identifier hs-type">truncate</span></a></span></span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Real.html#Integral"><span class="hs-identifier hs-type">Integral</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484120"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484121"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484120"><span class="hs-identifier hs-type">b</span></a></span></span><span>
</span><span id="line-221"></span><span>    </span><span class="hs-comment">-- | @'round' x@ returns the nearest integer to @x@;</span><span>
</span><span id="line-222"></span><span>    </span><span class="hs-comment">--   the even integer if @x@ is equidistant between two integers</span><span>
</span><span id="line-223"></span><span>    </span><span id="local-6989586621679483844"><span id="round"><span class="annot"><a href="GHC.Real.html#round"><span class="hs-identifier hs-type">round</span></a></span></span><span>               </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Real.html#Integral"><span class="hs-identifier hs-type">Integral</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679483844"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484121"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679483844"><span class="hs-identifier hs-type">b</span></a></span></span><span>
</span><span id="line-224"></span><span>    </span><span class="hs-comment">-- | @'ceiling' x@ returns the least integer not less than @x@</span><span>
</span><span id="line-225"></span><span>    </span><span id="local-6989586621679483842"><span id="ceiling"><span class="annot"><a href="GHC.Real.html#ceiling"><span class="hs-identifier hs-type">ceiling</span></a></span></span><span>             </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Real.html#Integral"><span class="hs-identifier hs-type">Integral</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679483842"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484121"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679483842"><span class="hs-identifier hs-type">b</span></a></span></span><span>
</span><span id="line-226"></span><span>    </span><span class="hs-comment">-- | @'floor' x@ returns the greatest integer not greater than @x@</span><span>
</span><span id="line-227"></span><span>    </span><span id="local-6989586621679483840"><span id="floor"><span class="annot"><a href="GHC.Real.html#floor"><span class="hs-identifier hs-type">floor</span></a></span></span><span>               </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Real.html#Integral"><span class="hs-identifier hs-type">Integral</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679483840"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484121"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679483840"><span class="hs-identifier hs-type">b</span></a></span></span><span>
</span><span id="line-228"></span><span>
</span><span id="line-229"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Real.html#truncate"><span class="hs-pragma hs-type">truncate</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-230"></span><span>    </span><span id="local-6989586621679483837"><span class="annot"><a href="GHC.Real.html#truncate"><span class="hs-identifier hs-var hs-var">truncate</span></a></span><span> </span><span id="local-6989586621679483835"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483835"><span class="hs-identifier hs-var">x</span></a></span></span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679483834"><span class="hs-identifier hs-var">m</span></a></span><span>  </span><span class="hs-keyword">where</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679483834"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679483834"><span class="hs-identifier hs-var">m</span></a></span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; (b, a)
forall a b. (RealFrac a, Integral b) =&gt; a -&gt; (b, a)
</span><a href="GHC.Real.html#properFraction"><span class="hs-identifier hs-var">properFraction</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483835"><span class="hs-identifier hs-var">x</span></a></span></span><span>
</span><span id="line-231"></span><span>
</span><span id="line-232"></span><span>    </span><span id="local-6989586621679483831"><span class="annot"><a href="GHC.Real.html#round"><span class="hs-identifier hs-var hs-var">round</span></a></span><span> </span><span id="local-6989586621679483810"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483810"><span class="hs-identifier hs-var">x</span></a></span></span><span>             </span><span class="hs-glyph">=</span><span>  </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679483807"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679483807"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679483806"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483806"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; (b, a)
forall a b. (RealFrac a, Integral b) =&gt; a -&gt; (b, a)
</span><a href="GHC.Real.html#properFraction"><span class="hs-identifier hs-var">properFraction</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483810"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-233"></span><span>                               </span><span id="local-6989586621679483799"><span class="annot"><span class="annottext">m :: b
</span><a href="#local-6989586621679483799"><span class="hs-identifier hs-var hs-var">m</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483806"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">0</span></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679483807"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">b -&gt; b -&gt; b
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><span class="hs-number">1</span></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679483807"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">b -&gt; b -&gt; b
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><span class="hs-number">1</span></span><span>
</span><span id="line-234"></span><span>                           </span><span class="hs-keyword">in</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">a -&gt; a
forall a. Num a =&gt; a -&gt; a
</span><a href="GHC.Num.html#signum"><span class="hs-identifier hs-var">signum</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; a
forall a. Num a =&gt; a -&gt; a
</span><a href="GHC.Num.html#abs"><span class="hs-identifier hs-var">abs</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483806"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">0.5</span></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-235"></span><span>                                </span><span class="hs-glyph">-</span><span class="hs-number">1</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679483807"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-236"></span><span>                                </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">0</span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">b -&gt; Bool
forall a. Integral a =&gt; a -&gt; Bool
</span><a href="GHC.Real.html#even"><span class="hs-identifier hs-var">even</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679483807"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679483807"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679483799"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-237"></span><span>                                </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">1</span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679483799"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-238"></span><span>                                </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; b
forall a. [Char] -&gt; a
</span><a href="GHC.Err.html#errorWithoutStackTrace"><span class="hs-identifier hs-var">errorWithoutStackTrace</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;round default defn: Bad value&quot;</span></span></span><span>
</span><span id="line-239"></span><span>
</span><span id="line-240"></span><span>    </span><span id="local-6989586621679483795"><span class="annot"><a href="GHC.Real.html#ceiling"><span class="hs-identifier hs-var hs-var">ceiling</span></a></span><span> </span><span id="local-6989586621679483784"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483784"><span class="hs-identifier hs-var">x</span></a></span></span><span>           </span><span class="hs-glyph">=</span><span>  </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483783"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E"><span class="hs-operator hs-var">&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">0</span></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679483781"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">b -&gt; b -&gt; b
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><span class="hs-number">1</span></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679483781"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-241"></span><span>                           </span><span class="hs-keyword">where</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679483781"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679483781"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679483783"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483783"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; (b, a)
forall a b. (RealFrac a, Integral b) =&gt; a -&gt; (b, a)
</span><a href="GHC.Real.html#properFraction"><span class="hs-identifier hs-var">properFraction</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483784"><span class="hs-identifier hs-var">x</span></a></span></span><span>
</span><span id="line-242"></span><span>
</span><span id="line-243"></span><span>    </span><span id="local-6989586621679483778"><span class="annot"><a href="GHC.Real.html#floor"><span class="hs-identifier hs-var hs-var">floor</span></a></span><span> </span><span id="local-6989586621679483767"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483767"><span class="hs-identifier hs-var">x</span></a></span></span><span>             </span><span class="hs-glyph">=</span><span>  </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483766"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">0</span></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679483765"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">b -&gt; b -&gt; b
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><span class="hs-number">1</span></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679483765"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-244"></span><span>                           </span><span class="hs-keyword">where</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679483765"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679483765"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679483766"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483766"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; (b, a)
forall a b. (RealFrac a, Integral b) =&gt; a -&gt; (b, a)
</span><a href="GHC.Real.html#properFraction"><span class="hs-identifier hs-var">properFraction</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483767"><span class="hs-identifier hs-var">x</span></a></span></span><span>
</span><span id="line-245"></span><span>
</span><span id="line-246"></span><span class="hs-comment">-- These 'numeric' enumerations come straight from the Report</span><span>
</span><span id="line-247"></span><span>
</span><span id="line-248"></span><span id="local-6989586621679484111"><span class="annot"><a href="GHC.Real.html#numericEnumFrom"><span class="hs-identifier hs-type">numericEnumFrom</span></a></span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Real.html#Fractional"><span class="hs-identifier hs-type">Fractional</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484111"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484111"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679484111"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-249"></span><span id="numericEnumFrom"><span class="annot"><span class="annottext">numericEnumFrom :: forall a. Fractional a =&gt; a -&gt; [a]
</span><a href="GHC.Real.html#numericEnumFrom"><span class="hs-identifier hs-var hs-var">numericEnumFrom</span></a></span></span><span> </span><span id="local-6989586621679483758"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483758"><span class="hs-identifier hs-var">n</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; [a]
</span><a href="#local-6989586621679483757"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">0</span></span><span>
</span><span id="line-250"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-251"></span><span>    </span><span class="hs-comment">-- See Note [Numeric Stability of Enumerating Floating Numbers]</span><span>
</span><span id="line-252"></span><span>    </span><span id="local-6989586621679483757"><span class="annot"><span class="annottext">go :: a -&gt; [a]
</span><a href="#local-6989586621679483757"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679483754"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483754"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679483752"><span class="annot"><span class="annottext">n' :: a
</span><a href="#local-6989586621679483752"><span class="hs-identifier hs-var hs-var">n'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483758"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483754"><span class="hs-identifier hs-var">k</span></a></span><span>
</span><span id="line-253"></span><span>             </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483752"><span class="hs-identifier hs-var">n'</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a]
</span><a href="#local-6989586621679483757"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483754"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-254"></span><span>
</span><span id="line-255"></span><span id="local-6989586621679484109"><span class="annot"><a href="GHC.Real.html#numericEnumFromThen"><span class="hs-identifier hs-type">numericEnumFromThen</span></a></span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Real.html#Fractional"><span class="hs-identifier hs-type">Fractional</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484109"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484109"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484109"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679484109"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-256"></span><span id="numericEnumFromThen"><span class="annot"><span class="annottext">numericEnumFromThen :: forall a. Fractional a =&gt; a -&gt; a -&gt; [a]
</span><a href="GHC.Real.html#numericEnumFromThen"><span class="hs-identifier hs-var hs-var">numericEnumFromThen</span></a></span></span><span> </span><span id="local-6989586621679483747"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483747"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679483746"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483746"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; [a]
</span><a href="#local-6989586621679483745"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">0</span></span><span>
</span><span id="line-257"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-258"></span><span>    </span><span id="local-6989586621679483743"><span class="annot"><span class="annottext">step :: a
</span><a href="#local-6989586621679483743"><span class="hs-identifier hs-var hs-var">step</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483746"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483747"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-259"></span><span>    </span><span class="hs-comment">-- See Note [Numeric Stability of Enumerating Floating Numbers]</span><span>
</span><span id="line-260"></span><span>    </span><span id="local-6989586621679483745"><span class="annot"><span class="annottext">go :: a -&gt; [a]
</span><a href="#local-6989586621679483745"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679483740"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483740"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679483737"><span class="annot"><span class="annottext">n' :: a
</span><a href="#local-6989586621679483737"><span class="hs-identifier hs-var hs-var">n'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483747"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483740"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483743"><span class="hs-identifier hs-var">step</span></a></span><span>
</span><span id="line-261"></span><span>             </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483737"><span class="hs-identifier hs-var">n'</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a]
</span><a href="#local-6989586621679483745"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483740"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-262"></span><span>
</span><span id="line-263"></span><span id="local-6989586621679484107"><span class="annot"><a href="GHC.Real.html#numericEnumFromTo"><span class="hs-identifier hs-type">numericEnumFromTo</span></a></span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#Ord"><span class="hs-identifier hs-type">Ord</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484107"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Real.html#Fractional"><span class="hs-identifier hs-type">Fractional</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484107"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484107"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484107"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679484107"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-264"></span><span id="numericEnumFromTo"><span class="annot"><span class="annottext">numericEnumFromTo :: forall a. (Ord a, Fractional a) =&gt; a -&gt; a -&gt; [a]
</span><a href="GHC.Real.html#numericEnumFromTo"><span class="hs-identifier hs-var hs-var">numericEnumFromTo</span></a></span></span><span> </span><span id="local-6989586621679483726"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483726"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679483725"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483725"><span class="hs-identifier hs-var">m</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; [a] -&gt; [a]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="GHC.List.html#takeWhile"><span class="hs-identifier hs-var">takeWhile</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483725"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">1</span></span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Fractional a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Real.html#%2F"><span class="hs-operator hs-var">/</span></a></span><span class="annot"><span class="annottext">a
</span><span class="hs-number">2</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; [a]
forall a. Fractional a =&gt; a -&gt; [a]
</span><a href="GHC.Real.html#numericEnumFrom"><span class="hs-identifier hs-var">numericEnumFrom</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483726"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-265"></span><span>
</span><span id="line-266"></span><span id="local-6989586621679484104"><span class="annot"><a href="GHC.Real.html#numericEnumFromThenTo"><span class="hs-identifier hs-type">numericEnumFromThenTo</span></a></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#Ord"><span class="hs-identifier hs-type">Ord</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484104"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Real.html#Fractional"><span class="hs-identifier hs-type">Fractional</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484104"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484104"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484104"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484104"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679484104"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-267"></span><span id="numericEnumFromThenTo"><span class="annot"><span class="annottext">numericEnumFromThenTo :: forall a. (Ord a, Fractional a) =&gt; a -&gt; a -&gt; a -&gt; [a]
</span><a href="GHC.Real.html#numericEnumFromThenTo"><span class="hs-identifier hs-var hs-var">numericEnumFromThenTo</span></a></span></span><span> </span><span id="local-6989586621679483717"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483717"><span class="hs-identifier hs-var">e1</span></a></span></span><span> </span><span id="local-6989586621679483716"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483716"><span class="hs-identifier hs-var">e2</span></a></span></span><span> </span><span id="local-6989586621679483715"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483715"><span class="hs-identifier hs-var">e3</span></a></span></span><span>
</span><span id="line-268"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; [a] -&gt; [a]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="GHC.List.html#takeWhile"><span class="hs-identifier hs-var">takeWhile</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679483714"><span class="hs-identifier hs-var">predicate</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; a -&gt; [a]
forall a. Fractional a =&gt; a -&gt; a -&gt; [a]
</span><a href="GHC.Real.html#numericEnumFromThen"><span class="hs-identifier hs-var">numericEnumFromThen</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483717"><span class="hs-identifier hs-var">e1</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483716"><span class="hs-identifier hs-var">e2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-269"></span><span>                                </span><span class="hs-keyword">where</span><span>
</span><span id="line-270"></span><span>                                 </span><span id="local-6989586621679483710"><span class="annot"><span class="annottext">mid :: a
</span><a href="#local-6989586621679483710"><span class="hs-identifier hs-var hs-var">mid</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483716"><span class="hs-identifier hs-var">e2</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483717"><span class="hs-identifier hs-var">e1</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Fractional a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Real.html#%2F"><span class="hs-operator hs-var">/</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">2</span></span><span>
</span><span id="line-271"></span><span>                                 </span><span id="local-6989586621679483714"><span class="annot"><span class="annottext">predicate :: a -&gt; Bool
</span><a href="#local-6989586621679483714"><span class="hs-identifier hs-var hs-var">predicate</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483716"><span class="hs-identifier hs-var">e2</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483717"><span class="hs-identifier hs-var">e1</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483715"><span class="hs-identifier hs-var">e3</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483710"><span class="hs-identifier hs-var">mid</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-272"></span><span>                                           </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483715"><span class="hs-identifier hs-var">e3</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483710"><span class="hs-identifier hs-var">mid</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-273"></span><span>
</span><span id="line-274"></span><span class="hs-comment">{- Note [Numeric Stability of Enumerating Floating Numbers]
-----------------------------------------------------------
When enumerate floating numbers, we could add the increment to the last number
at every run (as what we did previously):

    numericEnumFrom n =  n `seq` (n : numericEnumFrom (n + 1))

This approach is concise and really fast, only needs an addition operation.
However when a floating number is large enough, for `n`, `n` and `n+1` will
have the same binary representation. For example (all number has type
`Double`):

    9007199254740990                 is: 0x433ffffffffffffe
    9007199254740990 + 1             is: 0x433fffffffffffff
    (9007199254740990 + 1) + 1       is: 0x4340000000000000
    ((9007199254740990 + 1) + 1) + 1 is: 0x4340000000000000

When we evaluate ([9007199254740990..9007199254740991] :: Double), we would
never reach the condition in `numericEnumFromTo`

    9007199254740990 + 1 + 1 + ... &gt; 9007199254740991 + 1/2

We would fall into infinite loop (as reported in #15081).

To remedy the situation, we record the number of `1` that needed to be added
to the start number, rather than increasing `1` at every time. This approach
can improvement the numeric stability greatly at the cost of a multiplication.

Furthermore, we use the type of the enumerated number, `Fractional a =&gt; a`,
as the type of multiplier. In rare situations, the multiplier could be very
large and will lead to the enumeration to infinite loop, too, which should
be very rare. Consider the following example:

    [1..9007199254740994]

We could fix that by using an Integer as multiplier but we don't do that.
The benchmark on T7954.hs shows that this approach leads to significant
degeneration on performance (33% increase allocation and 300% increase on
elapsed time).

See #15081 and Phab:D4650 for the related discussion about this problem.
-}</span><span>
</span><span id="line-316"></span><span>
</span><span id="line-317"></span><span class="hs-comment">--------------------------------------------------------------</span><span>
</span><span id="line-318"></span><span class="hs-comment">-- Instances for Int</span><span>
</span><span id="line-319"></span><span class="hs-comment">--------------------------------------------------------------</span><span>
</span><span id="line-320"></span><span>
</span><span id="line-321"></span><span class="hs-comment">-- | @since 2.0.1</span><span>
</span><span id="line-322"></span><span class="hs-keyword">instance</span><span>  </span><span class="annot"><a href="GHC.Real.html#Real"><span class="hs-identifier hs-type">Real</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-323"></span><span>    </span><span id="local-6989586621679483695"><span class="annot"><span class="annottext">toRational :: Int -&gt; Rational
</span><a href="GHC.Real.html#toRational"><span class="hs-identifier hs-var hs-var hs-var hs-var">toRational</span></a></span></span><span> </span><span id="local-6989586621679483694"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483694"><span class="hs-identifier hs-var">x</span></a></span></span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Int -&gt; Integer
forall a. Integral a =&gt; a -&gt; Integer
</span><a href="GHC.Real.html#toInteger"><span class="hs-identifier hs-var">toInteger</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483694"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Rational
forall a. a -&gt; a -&gt; Ratio a
</span><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-var">:%</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">1</span></span><span>
</span><span id="line-324"></span><span>
</span><span id="line-325"></span><span class="hs-comment">-- | @since 2.0.1</span><span>
</span><span id="line-326"></span><span class="hs-keyword">instance</span><span>  </span><span class="annot"><a href="GHC.Real.html#Integral"><span class="hs-identifier hs-type">Integral</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-327"></span><span>    </span><span id="local-6989586621679483680"><span class="annot"><span class="annottext">toInteger :: Int -&gt; Integer
</span><a href="GHC.Real.html#toInteger"><span class="hs-identifier hs-var hs-var hs-var hs-var">toInteger</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679483679"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679483679"><span class="hs-identifier hs-var">i</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Integer
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#IS"><span class="hs-identifier hs-var">IS</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679483679"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-328"></span><span>
</span><span id="line-329"></span><span>    </span><span id="local-6989586621679483669"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483669"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679483668"><span class="annot"><span class="annottext">quot :: Int -&gt; Int -&gt; Int
</span><a href="#local-6989586621679483668"><span class="hs-operator hs-var hs-var hs-var hs-var">`quot`</span></a></span></span><span> </span><span id="local-6989586621679483667"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483667"><span class="hs-identifier hs-var">b</span></a></span></span><span>
</span><span id="line-330"></span><span>     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483667"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>                     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
forall a. a
</span><a href="GHC.Real.html#divZeroError"><span class="hs-identifier hs-var">divZeroError</span></a></span><span>
</span><span id="line-331"></span><span>     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483667"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">-</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483669"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
forall a. Bounded a =&gt; a
</span><a href="GHC.Enum.html#minBound"><span class="hs-identifier hs-var">minBound</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
forall a. a
</span><a href="GHC.Real.html#overflowError"><span class="hs-identifier hs-var">overflowError</span></a></span><span> </span><span class="hs-comment">-- Note [Order of tests]</span><span>
</span><span id="line-332"></span><span>                                                  </span><span class="hs-comment">-- in GHC.Int</span><span>
</span><span id="line-333"></span><span>     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                  </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483669"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
</span><a href="GHC.Base.html#quotInt"><span class="hs-operator hs-var">`quotInt`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483667"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-334"></span><span>
</span><span id="line-335"></span><span>    </span><span class="hs-glyph">!</span><span id="local-6989586621679483658"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483658"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679483657"><span class="annot"><span class="annottext">rem :: Int -&gt; Int -&gt; Int
</span><a href="#local-6989586621679483657"><span class="hs-operator hs-var hs-var hs-var hs-var">`rem`</span></a></span></span><span> </span><span id="local-6989586621679483656"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483656"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-comment">-- See Note [Special case of mod and rem is lazy]</span><span>
</span><span id="line-336"></span><span>     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483656"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>                     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
forall a. a
</span><a href="GHC.Real.html#divZeroError"><span class="hs-identifier hs-var">divZeroError</span></a></span><span>
</span><span id="line-337"></span><span>     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483656"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">-</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>                  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-338"></span><span>     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                  </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483658"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
</span><a href="GHC.Base.html#remInt"><span class="hs-operator hs-var">`remInt`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483656"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-339"></span><span>
</span><span id="line-340"></span><span>    </span><span id="local-6989586621679483647"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483647"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679483646"><span class="annot"><span class="annottext">div :: Int -&gt; Int -&gt; Int
</span><a href="#local-6989586621679483646"><span class="hs-operator hs-var hs-var hs-var hs-var">`div`</span></a></span></span><span> </span><span id="local-6989586621679483645"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483645"><span class="hs-identifier hs-var">b</span></a></span></span><span>
</span><span id="line-341"></span><span>     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483645"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>                     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
forall a. a
</span><a href="GHC.Real.html#divZeroError"><span class="hs-identifier hs-var">divZeroError</span></a></span><span>
</span><span id="line-342"></span><span>     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483645"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">-</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483647"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
forall a. Bounded a =&gt; a
</span><a href="GHC.Enum.html#minBound"><span class="hs-identifier hs-var">minBound</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
forall a. a
</span><a href="GHC.Real.html#overflowError"><span class="hs-identifier hs-var">overflowError</span></a></span><span> </span><span class="hs-comment">-- Note [Order of tests]</span><span>
</span><span id="line-343"></span><span>                                                  </span><span class="hs-comment">-- in GHC.Int</span><span>
</span><span id="line-344"></span><span>     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                  </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483647"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
</span><a href="GHC.Base.html#divInt"><span class="hs-operator hs-var">`divInt`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483645"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-345"></span><span>
</span><span id="line-346"></span><span>    </span><span class="hs-glyph">!</span><span id="local-6989586621679483638"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483638"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679483637"><span class="annot"><span class="annottext">mod :: Int -&gt; Int -&gt; Int
</span><a href="#local-6989586621679483637"><span class="hs-operator hs-var hs-var hs-var hs-var">`mod`</span></a></span></span><span> </span><span id="local-6989586621679483636"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483636"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-comment">-- See Note [Special case of mod and rem is lazy]</span><span>
</span><span id="line-347"></span><span>     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483636"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>                     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
forall a. a
</span><a href="GHC.Real.html#divZeroError"><span class="hs-identifier hs-var">divZeroError</span></a></span><span>
</span><span id="line-348"></span><span>     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483636"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">-</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>                  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-349"></span><span>     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                  </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483638"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
</span><a href="GHC.Base.html#modInt"><span class="hs-operator hs-var">`modInt`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483636"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-350"></span><span>
</span><span id="line-351"></span><span>    </span><span id="local-6989586621679483627"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483627"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679483626"><span class="annot"><span class="annottext">quotRem :: Int -&gt; Int -&gt; (Int, Int)
</span><a href="#local-6989586621679483626"><span class="hs-operator hs-var hs-var hs-var hs-var">`quotRem`</span></a></span></span><span> </span><span id="local-6989586621679483625"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483625"><span class="hs-identifier hs-var">b</span></a></span></span><span>
</span><span id="line-352"></span><span>     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483625"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>                     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Int, Int)
forall a. a
</span><a href="GHC.Real.html#divZeroError"><span class="hs-identifier hs-var">divZeroError</span></a></span><span>
</span><span id="line-353"></span><span>       </span><span class="hs-comment">-- Note [Order of tests] in GHC.Int</span><span>
</span><span id="line-354"></span><span>     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483625"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">-</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483627"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
forall a. Bounded a =&gt; a
</span><a href="GHC.Enum.html#minBound"><span class="hs-identifier hs-var">minBound</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
forall a. a
</span><a href="GHC.Real.html#overflowError"><span class="hs-identifier hs-var">overflowError</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span class="hs-special">)</span><span>
</span><span id="line-355"></span><span>     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                  </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483627"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; (Int, Int)
</span><a href="GHC.Base.html#quotRemInt"><span class="hs-operator hs-var">`quotRemInt`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483625"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-356"></span><span>
</span><span id="line-357"></span><span>    </span><span id="local-6989586621679483616"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483616"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679483615"><span class="annot"><span class="annottext">divMod :: Int -&gt; Int -&gt; (Int, Int)
</span><a href="#local-6989586621679483615"><span class="hs-operator hs-var hs-var hs-var hs-var">`divMod`</span></a></span></span><span> </span><span id="local-6989586621679483614"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483614"><span class="hs-identifier hs-var">b</span></a></span></span><span>
</span><span id="line-358"></span><span>     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483614"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>                     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Int, Int)
forall a. a
</span><a href="GHC.Real.html#divZeroError"><span class="hs-identifier hs-var">divZeroError</span></a></span><span>
</span><span id="line-359"></span><span>       </span><span class="hs-comment">-- Note [Order of tests] in GHC.Int</span><span>
</span><span id="line-360"></span><span>     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483614"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">-</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483616"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
forall a. Bounded a =&gt; a
</span><a href="GHC.Enum.html#minBound"><span class="hs-identifier hs-var">minBound</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
forall a. a
</span><a href="GHC.Real.html#overflowError"><span class="hs-identifier hs-var">overflowError</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span class="hs-special">)</span><span>
</span><span id="line-361"></span><span>     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                  </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483616"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; (Int, Int)
</span><a href="GHC.Base.html#divModInt"><span class="hs-operator hs-var">`divModInt`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483614"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-362"></span><span>
</span><span id="line-363"></span><span class="hs-comment">{- Note [Special case of mod and rem is lazy]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The `quotRem`/`divMod` CPU instruction fails for minBound `quotRem` -1, but
minBound `rem` -1 is well-defined (0). We therefore special-case for `b == -1`,
but not for `a == minBound` because of Note [Order of tests] in GHC.Int. But
now we have to make sure the function stays strict in a, to guarantee unboxing.
Hence the bang on a, see #18187.
-}</span><span>
</span><span id="line-371"></span><span>
</span><span id="line-372"></span><span class="hs-comment">--------------------------------------------------------------</span><span>
</span><span id="line-373"></span><span class="hs-comment">-- Instances for @Word@</span><span>
</span><span id="line-374"></span><span class="hs-comment">--------------------------------------------------------------</span><span>
</span><span id="line-375"></span><span>
</span><span id="line-376"></span><span class="hs-comment">-- | @since 2.01</span><span>
</span><span id="line-377"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="GHC.Real.html#Real"><span class="hs-identifier hs-type">Real</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Word"><span class="hs-identifier hs-type">Word</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-378"></span><span>    </span><span id="local-6989586621679483602"><span class="annot"><span class="annottext">toRational :: Word -&gt; Rational
</span><a href="GHC.Real.html#toRational"><span class="hs-identifier hs-var hs-var hs-var hs-var">toRational</span></a></span></span><span> </span><span id="local-6989586621679483601"><span class="annot"><span class="annottext">Word
</span><a href="#local-6989586621679483601"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word -&gt; Integer
forall a. Integral a =&gt; a -&gt; Integer
</span><a href="GHC.Real.html#toInteger"><span class="hs-identifier hs-var">toInteger</span></a></span><span> </span><span class="annot"><span class="annottext">Word
</span><a href="#local-6989586621679483601"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Rational
forall a. Integral a =&gt; a -&gt; a -&gt; Ratio a
</span><a href="GHC.Real.html#%25"><span class="hs-operator hs-var">%</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">1</span></span><span>
</span><span id="line-379"></span><span>
</span><span id="line-380"></span><span class="hs-comment">-- | @since 2.01</span><span>
</span><span id="line-381"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="GHC.Real.html#Integral"><span class="hs-identifier hs-type">Integral</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Word"><span class="hs-identifier hs-type">Word</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-382"></span><span>    </span><span id="local-6989586621679483585"><span class="annot"><span class="annottext">quot :: Word -&gt; Word -&gt; Word
</span><a href="#local-6989586621679483585"><span class="hs-identifier hs-var hs-var hs-var hs-var">quot</span></a></span></span><span>    </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-type">W#</span></a></span><span> </span><span id="local-6989586621679483584"><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679483584"><span class="hs-identifier hs-var">x#</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679483583"><span class="annot"><span class="annottext">y :: Word
</span><a href="#local-6989586621679483583"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-type">W#</span></a></span><span> </span><span id="local-6989586621679483582"><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679483582"><span class="hs-identifier hs-var">y#</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-383"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Word
</span><a href="#local-6989586621679483583"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Word -&gt; Word -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%2F%3D"><span class="hs-operator hs-var">/=</span></a></span><span> </span><span class="annot"><span class="annottext">Word
</span><span class="hs-number">0</span></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Word
</span><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-var">W#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679483584"><span class="hs-identifier hs-var">x#</span></a></span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Word# -&gt; Word#
</span><a href="../../ghc-prim/src/GHC.Prim.html#quotWord%23"><span class="hs-operator hs-var">`quotWord#`</span></a></span><span> </span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679483582"><span class="hs-identifier hs-var">y#</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-384"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word
forall a. a
</span><a href="GHC.Real.html#divZeroError"><span class="hs-identifier hs-var">divZeroError</span></a></span><span>
</span><span id="line-385"></span><span>    </span><span id="local-6989586621679483578"><span class="annot"><span class="annottext">rem :: Word -&gt; Word -&gt; Word
</span><a href="#local-6989586621679483578"><span class="hs-identifier hs-var hs-var hs-var hs-var">rem</span></a></span></span><span>     </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-type">W#</span></a></span><span> </span><span id="local-6989586621679483577"><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679483577"><span class="hs-identifier hs-var">x#</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679483576"><span class="annot"><span class="annottext">y :: Word
</span><a href="#local-6989586621679483576"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-type">W#</span></a></span><span> </span><span id="local-6989586621679483575"><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679483575"><span class="hs-identifier hs-var">y#</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-386"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Word
</span><a href="#local-6989586621679483576"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Word -&gt; Word -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%2F%3D"><span class="hs-operator hs-var">/=</span></a></span><span> </span><span class="annot"><span class="annottext">Word
</span><span class="hs-number">0</span></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Word
</span><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-var">W#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679483577"><span class="hs-identifier hs-var">x#</span></a></span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Word# -&gt; Word#
</span><a href="../../ghc-prim/src/GHC.Prim.html#remWord%23"><span class="hs-operator hs-var">`remWord#`</span></a></span><span> </span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679483575"><span class="hs-identifier hs-var">y#</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-387"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word
forall a. a
</span><a href="GHC.Real.html#divZeroError"><span class="hs-identifier hs-var">divZeroError</span></a></span><span>
</span><span id="line-388"></span><span>    </span><span id="local-6989586621679483572"><span class="annot"><span class="annottext">div :: Word -&gt; Word -&gt; Word
</span><a href="#local-6989586621679483572"><span class="hs-identifier hs-var hs-var hs-var hs-var">div</span></a></span></span><span>     </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-type">W#</span></a></span><span> </span><span id="local-6989586621679483571"><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679483571"><span class="hs-identifier hs-var">x#</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679483570"><span class="annot"><span class="annottext">y :: Word
</span><a href="#local-6989586621679483570"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-type">W#</span></a></span><span> </span><span id="local-6989586621679483569"><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679483569"><span class="hs-identifier hs-var">y#</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-389"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Word
</span><a href="#local-6989586621679483570"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Word -&gt; Word -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%2F%3D"><span class="hs-operator hs-var">/=</span></a></span><span> </span><span class="annot"><span class="annottext">Word
</span><span class="hs-number">0</span></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Word
</span><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-var">W#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679483571"><span class="hs-identifier hs-var">x#</span></a></span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Word# -&gt; Word#
</span><a href="../../ghc-prim/src/GHC.Prim.html#quotWord%23"><span class="hs-operator hs-var">`quotWord#`</span></a></span><span> </span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679483569"><span class="hs-identifier hs-var">y#</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-390"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word
forall a. a
</span><a href="GHC.Real.html#divZeroError"><span class="hs-identifier hs-var">divZeroError</span></a></span><span>
</span><span id="line-391"></span><span>    </span><span id="local-6989586621679483566"><span class="annot"><span class="annottext">mod :: Word -&gt; Word -&gt; Word
</span><a href="#local-6989586621679483566"><span class="hs-identifier hs-var hs-var hs-var hs-var">mod</span></a></span></span><span>     </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-type">W#</span></a></span><span> </span><span id="local-6989586621679483565"><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679483565"><span class="hs-identifier hs-var">x#</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679483564"><span class="annot"><span class="annottext">y :: Word
</span><a href="#local-6989586621679483564"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-type">W#</span></a></span><span> </span><span id="local-6989586621679483563"><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679483563"><span class="hs-identifier hs-var">y#</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-392"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Word
</span><a href="#local-6989586621679483564"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Word -&gt; Word -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%2F%3D"><span class="hs-operator hs-var">/=</span></a></span><span> </span><span class="annot"><span class="annottext">Word
</span><span class="hs-number">0</span></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Word
</span><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-var">W#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679483565"><span class="hs-identifier hs-var">x#</span></a></span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Word# -&gt; Word#
</span><a href="../../ghc-prim/src/GHC.Prim.html#remWord%23"><span class="hs-operator hs-var">`remWord#`</span></a></span><span> </span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679483563"><span class="hs-identifier hs-var">y#</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-393"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word
forall a. a
</span><a href="GHC.Real.html#divZeroError"><span class="hs-identifier hs-var">divZeroError</span></a></span><span>
</span><span id="line-394"></span><span>    </span><span id="local-6989586621679483560"><span class="annot"><span class="annottext">quotRem :: Word -&gt; Word -&gt; (Word, Word)
</span><a href="#local-6989586621679483560"><span class="hs-identifier hs-var hs-var hs-var hs-var">quotRem</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-type">W#</span></a></span><span> </span><span id="local-6989586621679483559"><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679483559"><span class="hs-identifier hs-var">x#</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679483558"><span class="annot"><span class="annottext">y :: Word
</span><a href="#local-6989586621679483558"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-type">W#</span></a></span><span> </span><span id="local-6989586621679483557"><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679483557"><span class="hs-identifier hs-var">y#</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-395"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Word
</span><a href="#local-6989586621679483558"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Word -&gt; Word -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%2F%3D"><span class="hs-operator hs-var">/=</span></a></span><span> </span><span class="annot"><span class="annottext">Word
</span><span class="hs-number">0</span></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679483559"><span class="hs-identifier hs-var">x#</span></a></span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Word# -&gt; (# Word#, Word# #)
</span><a href="../../ghc-prim/src/GHC.Prim.html#quotRemWord%23"><span class="hs-operator hs-var">`quotRemWord#`</span></a></span><span> </span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679483557"><span class="hs-identifier hs-var">y#</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-396"></span><span>                                  </span><span class="hs-special">(#</span><span> </span><span id="local-6989586621679483556"><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679483556"><span class="hs-identifier hs-var">q</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679483555"><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679483555"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-special">#)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-397"></span><span>                                      </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word# -&gt; Word
</span><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-var">W#</span></a></span><span> </span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679483556"><span class="hs-identifier hs-var">q</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Word
</span><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-var">W#</span></a></span><span> </span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679483555"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-398"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word, Word)
forall a. a
</span><a href="GHC.Real.html#divZeroError"><span class="hs-identifier hs-var">divZeroError</span></a></span><span>
</span><span id="line-399"></span><span>    </span><span id="local-6989586621679483552"><span class="annot"><span class="annottext">divMod :: Word -&gt; Word -&gt; (Word, Word)
</span><a href="#local-6989586621679483552"><span class="hs-identifier hs-var hs-var hs-var hs-var">divMod</span></a></span></span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-type">W#</span></a></span><span> </span><span id="local-6989586621679483551"><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679483551"><span class="hs-identifier hs-var">x#</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679483550"><span class="annot"><span class="annottext">y :: Word
</span><a href="#local-6989586621679483550"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-type">W#</span></a></span><span> </span><span id="local-6989586621679483549"><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679483549"><span class="hs-identifier hs-var">y#</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-400"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Word
</span><a href="#local-6989586621679483550"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Word -&gt; Word -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%2F%3D"><span class="hs-operator hs-var">/=</span></a></span><span> </span><span class="annot"><span class="annottext">Word
</span><span class="hs-number">0</span></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word# -&gt; Word
</span><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-var">W#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679483551"><span class="hs-identifier hs-var">x#</span></a></span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Word# -&gt; Word#
</span><a href="../../ghc-prim/src/GHC.Prim.html#quotWord%23"><span class="hs-operator hs-var">`quotWord#`</span></a></span><span> </span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679483549"><span class="hs-identifier hs-var">y#</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Word
</span><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-var">W#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679483551"><span class="hs-identifier hs-var">x#</span></a></span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Word# -&gt; Word#
</span><a href="../../ghc-prim/src/GHC.Prim.html#remWord%23"><span class="hs-operator hs-var">`remWord#`</span></a></span><span> </span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679483549"><span class="hs-identifier hs-var">y#</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-401"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Word, Word)
forall a. a
</span><a href="GHC.Real.html#divZeroError"><span class="hs-identifier hs-var">divZeroError</span></a></span><span>
</span><span id="line-402"></span><span>    </span><span id="local-6989586621679483548"><span class="annot"><span class="annottext">toInteger :: Word -&gt; Integer
</span><a href="GHC.Real.html#toInteger"><span class="hs-identifier hs-var hs-var hs-var hs-var">toInteger</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-type">W#</span></a></span><span> </span><span id="local-6989586621679483547"><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679483547"><span class="hs-identifier hs-var">x#</span></a></span></span><span class="hs-special">)</span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Integer
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerFromWord%23"><span class="hs-identifier hs-var">integerFromWord#</span></a></span><span> </span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679483547"><span class="hs-identifier hs-var">x#</span></a></span><span>
</span><span id="line-403"></span><span>
</span><span id="line-404"></span><span class="hs-comment">--------------------------------------------------------------</span><span>
</span><span id="line-405"></span><span class="hs-comment">-- Instances for Integer</span><span>
</span><span id="line-406"></span><span class="hs-comment">--------------------------------------------------------------</span><span>
</span><span id="line-407"></span><span>
</span><span id="line-408"></span><span class="hs-comment">-- | @since 2.0.1</span><span>
</span><span id="line-409"></span><span class="hs-keyword">instance</span><span>  </span><span class="annot"><a href="GHC.Real.html#Real"><span class="hs-identifier hs-type">Real</span></a></span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-identifier hs-type">Integer</span></a></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-410"></span><span>    </span><span id="local-6989586621679483538"><span class="annot"><span class="annottext">toRational :: Integer -&gt; Rational
</span><a href="GHC.Real.html#toRational"><span class="hs-identifier hs-var hs-var hs-var hs-var">toRational</span></a></span></span><span> </span><span id="local-6989586621679483537"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483537"><span class="hs-identifier hs-var">x</span></a></span></span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483537"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Rational
forall a. a -&gt; a -&gt; Ratio a
</span><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-var">:%</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">1</span></span><span>
</span><span id="line-411"></span><span>
</span><span id="line-412"></span><span class="hs-comment">-- | @since 4.8.0.0</span><span>
</span><span id="line-413"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="GHC.Real.html#Real"><span class="hs-identifier hs-type">Real</span></a></span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Natural.html#Natural"><span class="hs-identifier hs-type">Natural</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-414"></span><span>    </span><span id="local-6989586621679483527"><span class="annot"><span class="annottext">toRational :: Natural -&gt; Rational
</span><a href="GHC.Real.html#toRational"><span class="hs-identifier hs-var hs-var hs-var hs-var">toRational</span></a></span></span><span> </span><span id="local-6989586621679483526"><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679483526"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Natural -&gt; Integer
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerFromNatural"><span class="hs-identifier hs-var">integerFromNatural</span></a></span><span> </span><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679483526"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Rational
forall a. a -&gt; a -&gt; Ratio a
</span><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-var">:%</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">1</span></span><span>
</span><span id="line-415"></span><span>
</span><span id="line-416"></span><span class="hs-comment">-- Note [Integer division constant folding]</span><span>
</span><span id="line-417"></span><span class="hs-comment">-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span><span>
</span><span id="line-418"></span><span class="hs-comment">--</span><span>
</span><span id="line-419"></span><span class="hs-comment">-- Constant folding of quot, rem, div, mod, divMod and quotRem for Integer</span><span>
</span><span id="line-420"></span><span class="hs-comment">-- arguments depends crucially on inlining. Constant folding rules defined in</span><span>
</span><span id="line-421"></span><span class="hs-comment">-- GHC.Core.Opt.ConstantFold trigger for integerQuot, integerRem and so on.</span><span>
</span><span id="line-422"></span><span class="hs-comment">-- So if calls to quot, rem and so on were not inlined the rules would not fire.</span><span>
</span><span id="line-423"></span><span class="hs-comment">--</span><span>
</span><span id="line-424"></span><span class="hs-comment">-- The rules would also not fire if calls to integerQuot and so on were inlined,</span><span>
</span><span id="line-425"></span><span class="hs-comment">-- but this does not happen because they are all marked with NOINLINE pragma.</span><span>
</span><span id="line-426"></span><span>
</span><span id="line-427"></span><span>
</span><span id="line-428"></span><span class="hs-comment">-- | @since 2.0.1</span><span>
</span><span id="line-429"></span><span class="hs-keyword">instance</span><span>  </span><span class="annot"><a href="GHC.Real.html#Integral"><span class="hs-identifier hs-type">Integral</span></a></span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-identifier hs-type">Integer</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-430"></span><span>    </span><span id="local-6989586621679483513"><span class="annot"><span class="annottext">toInteger :: Integer -&gt; Integer
</span><a href="GHC.Real.html#toInteger"><span class="hs-identifier hs-var hs-var hs-var hs-var">toInteger</span></a></span></span><span> </span><span id="local-6989586621679483512"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483512"><span class="hs-identifier hs-var">n</span></a></span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483512"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-431"></span><span>
</span><span id="line-432"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Real.html#quot"><span class="hs-pragma hs-type">quot</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-433"></span><span>    </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679483508"><span class="annot"><span class="annottext">quot :: Integer -&gt; Integer -&gt; Integer
</span><a href="#local-6989586621679483508"><span class="hs-operator hs-var hs-var hs-var hs-var">`quot`</span></a></span></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer
forall a. a
</span><a href="GHC.Real.html#divZeroError"><span class="hs-identifier hs-var">divZeroError</span></a></span><span>
</span><span id="line-434"></span><span>    </span><span id="local-6989586621679483507"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483507"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="annot"><a href="GHC.Real.html#quot"><span class="hs-operator hs-var">`quot`</span></a></span><span> </span><span id="local-6989586621679483506"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483506"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483507"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerQuot"><span class="hs-operator hs-var">`integerQuot`</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483506"><span class="hs-identifier hs-var">d</span></a></span><span>
</span><span id="line-435"></span><span>
</span><span id="line-436"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Real.html#rem"><span class="hs-pragma hs-type">rem</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-437"></span><span>    </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679483503"><span class="annot"><span class="annottext">rem :: Integer -&gt; Integer -&gt; Integer
</span><a href="#local-6989586621679483503"><span class="hs-operator hs-var hs-var hs-var hs-var">`rem`</span></a></span></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer
forall a. a
</span><a href="GHC.Real.html#divZeroError"><span class="hs-identifier hs-var">divZeroError</span></a></span><span>
</span><span id="line-438"></span><span>    </span><span id="local-6989586621679483502"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483502"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="annot"><a href="GHC.Real.html#rem"><span class="hs-operator hs-var">`rem`</span></a></span><span> </span><span id="local-6989586621679483501"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483501"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483502"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerRem"><span class="hs-operator hs-var">`integerRem`</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483501"><span class="hs-identifier hs-var">d</span></a></span><span>
</span><span id="line-439"></span><span>
</span><span id="line-440"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Real.html#div"><span class="hs-pragma hs-type">div</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-441"></span><span>    </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679483498"><span class="annot"><span class="annottext">div :: Integer -&gt; Integer -&gt; Integer
</span><a href="#local-6989586621679483498"><span class="hs-operator hs-var hs-var hs-var hs-var">`div`</span></a></span></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer
forall a. a
</span><a href="GHC.Real.html#divZeroError"><span class="hs-identifier hs-var">divZeroError</span></a></span><span>
</span><span id="line-442"></span><span>    </span><span id="local-6989586621679483497"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483497"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="annot"><a href="GHC.Real.html#div"><span class="hs-operator hs-var">`div`</span></a></span><span> </span><span id="local-6989586621679483496"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483496"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483497"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerDiv"><span class="hs-operator hs-var">`integerDiv`</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483496"><span class="hs-identifier hs-var">d</span></a></span><span>
</span><span id="line-443"></span><span>
</span><span id="line-444"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Real.html#mod"><span class="hs-pragma hs-type">mod</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-445"></span><span>    </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679483493"><span class="annot"><span class="annottext">mod :: Integer -&gt; Integer -&gt; Integer
</span><a href="#local-6989586621679483493"><span class="hs-operator hs-var hs-var hs-var hs-var">`mod`</span></a></span></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer
forall a. a
</span><a href="GHC.Real.html#divZeroError"><span class="hs-identifier hs-var">divZeroError</span></a></span><span>
</span><span id="line-446"></span><span>    </span><span id="local-6989586621679483492"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483492"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="annot"><a href="GHC.Real.html#mod"><span class="hs-operator hs-var">`mod`</span></a></span><span> </span><span id="local-6989586621679483491"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483491"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483492"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerMod"><span class="hs-operator hs-var">`integerMod`</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483491"><span class="hs-identifier hs-var">d</span></a></span><span>
</span><span id="line-447"></span><span>
</span><span id="line-448"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Real.html#divMod"><span class="hs-pragma hs-type">divMod</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-449"></span><span>    </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679483488"><span class="annot"><span class="annottext">divMod :: Integer -&gt; Integer -&gt; (Integer, Integer)
</span><a href="#local-6989586621679483488"><span class="hs-operator hs-var hs-var hs-var hs-var">`divMod`</span></a></span></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Integer, Integer)
forall a. a
</span><a href="GHC.Real.html#divZeroError"><span class="hs-identifier hs-var">divZeroError</span></a></span><span>
</span><span id="line-450"></span><span>    </span><span id="local-6989586621679483487"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483487"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="annot"><a href="GHC.Real.html#divMod"><span class="hs-operator hs-var">`divMod`</span></a></span><span> </span><span id="local-6989586621679483486"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483486"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483487"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; (Integer, Integer)
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerDivMod"><span class="hs-operator hs-var">`integerDivMod`</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483486"><span class="hs-identifier hs-var">d</span></a></span><span>
</span><span id="line-451"></span><span>
</span><span id="line-452"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Real.html#quotRem"><span class="hs-pragma hs-type">quotRem</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-453"></span><span>    </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679483482"><span class="annot"><span class="annottext">quotRem :: Integer -&gt; Integer -&gt; (Integer, Integer)
</span><a href="#local-6989586621679483482"><span class="hs-operator hs-var hs-var hs-var hs-var">`quotRem`</span></a></span></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Integer, Integer)
forall a. a
</span><a href="GHC.Real.html#divZeroError"><span class="hs-identifier hs-var">divZeroError</span></a></span><span>
</span><span id="line-454"></span><span>    </span><span id="local-6989586621679483481"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483481"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="annot"><a href="GHC.Real.html#quotRem"><span class="hs-operator hs-var">`quotRem`</span></a></span><span> </span><span id="local-6989586621679483480"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483480"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483481"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; (Integer, Integer)
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerQuotRem"><span class="hs-operator hs-var">`integerQuotRem`</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483480"><span class="hs-identifier hs-var">d</span></a></span><span>
</span><span id="line-455"></span><span>
</span><span id="line-456"></span><span class="hs-comment">-- | @since 4.8.0.0</span><span>
</span><span id="line-457"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="GHC.Real.html#Integral"><span class="hs-identifier hs-type">Integral</span></a></span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Natural.html#Natural"><span class="hs-identifier hs-type">Natural</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-458"></span><span>    </span><span id="local-6989586621679483465"><span class="annot"><span class="annottext">toInteger :: Natural -&gt; Integer
</span><a href="GHC.Real.html#toInteger"><span class="hs-identifier hs-var hs-var hs-var hs-var">toInteger</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Natural -&gt; Integer
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerFromNatural"><span class="hs-identifier hs-var">integerFromNatural</span></a></span><span>
</span><span id="line-459"></span><span>
</span><span id="line-460"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Real.html#quot"><span class="hs-pragma hs-type">quot</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-461"></span><span>    </span><span class="annot"><span class="annottext">Natural
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679483461"><span class="annot"><span class="annottext">quot :: Natural -&gt; Natural -&gt; Natural
</span><a href="#local-6989586621679483461"><span class="hs-operator hs-var hs-var hs-var hs-var">`quot`</span></a></span></span><span> </span><span class="annot"><span class="annottext">Natural
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Natural
forall a. a
</span><a href="GHC.Real.html#divZeroError"><span class="hs-identifier hs-var">divZeroError</span></a></span><span>
</span><span id="line-462"></span><span>    </span><span id="local-6989586621679483460"><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679483460"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="annot"><a href="GHC.Real.html#quot"><span class="hs-operator hs-var">`quot`</span></a></span><span> </span><span id="local-6989586621679483459"><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679483459"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679483460"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Natural -&gt; Natural -&gt; Natural
</span><a href="../../ghc-bignum/src/GHC.Num.Natural.html#naturalQuot"><span class="hs-operator hs-var">`naturalQuot`</span></a></span><span> </span><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679483459"><span class="hs-identifier hs-var">d</span></a></span><span>
</span><span id="line-463"></span><span>
</span><span id="line-464"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Real.html#rem"><span class="hs-pragma hs-type">rem</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-465"></span><span>    </span><span class="annot"><span class="annottext">Natural
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679483456"><span class="annot"><span class="annottext">rem :: Natural -&gt; Natural -&gt; Natural
</span><a href="#local-6989586621679483456"><span class="hs-operator hs-var hs-var hs-var hs-var">`rem`</span></a></span></span><span> </span><span class="annot"><span class="annottext">Natural
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Natural
forall a. a
</span><a href="GHC.Real.html#divZeroError"><span class="hs-identifier hs-var">divZeroError</span></a></span><span>
</span><span id="line-466"></span><span>    </span><span id="local-6989586621679483455"><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679483455"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="annot"><a href="GHC.Real.html#rem"><span class="hs-operator hs-var">`rem`</span></a></span><span> </span><span id="local-6989586621679483454"><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679483454"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679483455"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Natural -&gt; Natural -&gt; Natural
</span><a href="../../ghc-bignum/src/GHC.Num.Natural.html#naturalRem"><span class="hs-operator hs-var">`naturalRem`</span></a></span><span> </span><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679483454"><span class="hs-identifier hs-var">d</span></a></span><span>
</span><span id="line-467"></span><span>
</span><span id="line-468"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Real.html#div"><span class="hs-pragma hs-type">div</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-469"></span><span>    </span><span class="annot"><span class="annottext">Natural
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679483451"><span class="annot"><span class="annottext">div :: Natural -&gt; Natural -&gt; Natural
</span><a href="#local-6989586621679483451"><span class="hs-operator hs-var hs-var hs-var hs-var">`div`</span></a></span></span><span> </span><span class="annot"><span class="annottext">Natural
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Natural
forall a. a
</span><a href="GHC.Real.html#divZeroError"><span class="hs-identifier hs-var">divZeroError</span></a></span><span>
</span><span id="line-470"></span><span>    </span><span id="local-6989586621679483450"><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679483450"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="annot"><a href="GHC.Real.html#div"><span class="hs-operator hs-var">`div`</span></a></span><span> </span><span id="local-6989586621679483449"><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679483449"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679483450"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Natural -&gt; Natural -&gt; Natural
</span><a href="../../ghc-bignum/src/GHC.Num.Natural.html#naturalQuot"><span class="hs-operator hs-var">`naturalQuot`</span></a></span><span> </span><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679483449"><span class="hs-identifier hs-var">d</span></a></span><span>
</span><span id="line-471"></span><span>
</span><span id="line-472"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Real.html#mod"><span class="hs-pragma hs-type">mod</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-473"></span><span>    </span><span class="annot"><span class="annottext">Natural
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679483446"><span class="annot"><span class="annottext">mod :: Natural -&gt; Natural -&gt; Natural
</span><a href="#local-6989586621679483446"><span class="hs-operator hs-var hs-var hs-var hs-var">`mod`</span></a></span></span><span> </span><span class="annot"><span class="annottext">Natural
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Natural
forall a. a
</span><a href="GHC.Real.html#divZeroError"><span class="hs-identifier hs-var">divZeroError</span></a></span><span>
</span><span id="line-474"></span><span>    </span><span id="local-6989586621679483445"><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679483445"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="annot"><a href="GHC.Real.html#mod"><span class="hs-operator hs-var">`mod`</span></a></span><span> </span><span id="local-6989586621679483444"><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679483444"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679483445"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Natural -&gt; Natural -&gt; Natural
</span><a href="../../ghc-bignum/src/GHC.Num.Natural.html#naturalRem"><span class="hs-operator hs-var">`naturalRem`</span></a></span><span> </span><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679483444"><span class="hs-identifier hs-var">d</span></a></span><span>
</span><span id="line-475"></span><span>
</span><span id="line-476"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Real.html#divMod"><span class="hs-pragma hs-type">divMod</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-477"></span><span>    </span><span class="annot"><span class="annottext">Natural
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679483441"><span class="annot"><span class="annottext">divMod :: Natural -&gt; Natural -&gt; (Natural, Natural)
</span><a href="#local-6989586621679483441"><span class="hs-operator hs-var hs-var hs-var hs-var">`divMod`</span></a></span></span><span> </span><span class="annot"><span class="annottext">Natural
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Natural, Natural)
forall a. a
</span><a href="GHC.Real.html#divZeroError"><span class="hs-identifier hs-var">divZeroError</span></a></span><span>
</span><span id="line-478"></span><span>    </span><span id="local-6989586621679483440"><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679483440"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="annot"><a href="GHC.Real.html#divMod"><span class="hs-operator hs-var">`divMod`</span></a></span><span> </span><span id="local-6989586621679483439"><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679483439"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679483440"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Natural -&gt; Natural -&gt; (Natural, Natural)
</span><a href="../../ghc-bignum/src/GHC.Num.Natural.html#naturalQuotRem"><span class="hs-operator hs-var">`naturalQuotRem`</span></a></span><span> </span><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679483439"><span class="hs-identifier hs-var">d</span></a></span><span>
</span><span id="line-479"></span><span>
</span><span id="line-480"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Real.html#quotRem"><span class="hs-pragma hs-type">quotRem</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-481"></span><span>    </span><span class="annot"><span class="annottext">Natural
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679483435"><span class="annot"><span class="annottext">quotRem :: Natural -&gt; Natural -&gt; (Natural, Natural)
</span><a href="#local-6989586621679483435"><span class="hs-operator hs-var hs-var hs-var hs-var">`quotRem`</span></a></span></span><span> </span><span class="annot"><span class="annottext">Natural
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Natural, Natural)
forall a. a
</span><a href="GHC.Real.html#divZeroError"><span class="hs-identifier hs-var">divZeroError</span></a></span><span>
</span><span id="line-482"></span><span>    </span><span id="local-6989586621679483434"><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679483434"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="annot"><a href="GHC.Real.html#quotRem"><span class="hs-operator hs-var">`quotRem`</span></a></span><span> </span><span id="local-6989586621679483433"><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679483433"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679483434"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Natural -&gt; Natural -&gt; (Natural, Natural)
</span><a href="../../ghc-bignum/src/GHC.Num.Natural.html#naturalQuotRem"><span class="hs-operator hs-var">`naturalQuotRem`</span></a></span><span> </span><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679483433"><span class="hs-identifier hs-var">d</span></a></span><span>
</span><span id="line-483"></span><span>
</span><span id="line-484"></span><span class="hs-comment">--------------------------------------------------------------</span><span>
</span><span id="line-485"></span><span class="hs-comment">-- Instances for @Ratio@</span><span>
</span><span id="line-486"></span><span class="hs-comment">--------------------------------------------------------------</span><span>
</span><span id="line-487"></span><span>
</span><span id="line-488"></span><span class="hs-comment">-- | @since 2.0.1</span><span>
</span><span id="line-489"></span><span id="local-6989586621679484101"><span class="hs-keyword">instance</span><span>  </span><span id="local-6989586621679483419"><span id="local-6989586621679483421"><span id="local-6989586621679483423"><span id="local-6989586621679483425"><span id="local-6989586621679483429"><span class="hs-special">(</span><span class="annot"><a href="GHC.Real.html#Integral"><span class="hs-identifier hs-type">Integral</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484101"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#Ord"><span class="hs-identifier hs-type">Ord</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Real.html#Ratio"><span class="hs-identifier hs-type">Ratio</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484101"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span></span></span></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-490"></span><span>    </span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="hs-pragma">instance</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#Ord"><span class="hs-pragma hs-type">Ord</span></a></span><span> </span><span class="annot"><a href="GHC.Real.html#Rational"><span class="hs-pragma hs-type">Rational</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-491"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621679483414"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483414"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-type">:%</span></a></span><span id="local-6989586621679483413"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483413"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679483412"><span class="annot"><span class="annottext">&lt;= :: Ratio a -&gt; Ratio a -&gt; Bool
</span><a href="#local-6989586621679483412"><span class="hs-operator hs-var hs-var hs-var hs-var">&lt;=</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679483411"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483411"><span class="hs-identifier hs-var">x'</span></a></span></span><span class="annot"><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-type">:%</span></a></span><span id="local-6989586621679483410"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483410"><span class="hs-identifier hs-var">y'</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483414"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483410"><span class="hs-identifier hs-var">y'</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483411"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483413"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-492"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621679483406"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483406"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-type">:%</span></a></span><span id="local-6989586621679483405"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483405"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679483404"><span class="annot"><span class="annottext">&lt; :: Ratio a -&gt; Ratio a -&gt; Bool
</span><a href="#local-6989586621679483404"><span class="hs-operator hs-var hs-var hs-var hs-var">&lt;</span></a></span></span><span>  </span><span class="hs-special">(</span><span id="local-6989586621679483403"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483403"><span class="hs-identifier hs-var">x'</span></a></span></span><span class="annot"><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-type">:%</span></a></span><span id="local-6989586621679483402"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483402"><span class="hs-identifier hs-var">y'</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483406"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483402"><span class="hs-identifier hs-var">y'</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span>  </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483403"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483405"><span class="hs-identifier hs-var">y</span></a></span></span><span>
</span><span id="line-493"></span><span>
</span><span id="line-494"></span><span class="hs-comment">-- | @since 2.0.1</span><span>
</span><span id="line-495"></span><span id="local-6989586621679484099"><span class="hs-keyword">instance</span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Real.html#Integral"><span class="hs-identifier hs-type">Integral</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484099"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Num.html#Num"><span class="hs-identifier hs-type">Num</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Real.html#Ratio"><span class="hs-identifier hs-type">Ratio</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484099"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-496"></span><span>    </span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="hs-pragma">instance</span><span> </span><span class="annot"><a href="GHC.Num.html#Num"><span class="hs-pragma hs-type">Num</span></a></span><span> </span><span class="annot"><a href="GHC.Real.html#Rational"><span class="hs-pragma hs-type">Rational</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-497"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621679483384"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483384"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-type">:%</span></a></span><span id="local-6989586621679483383"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483383"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679483382"><span class="annot"><span class="annottext">+ :: Ratio a -&gt; Ratio a -&gt; Ratio a
</span><a href="#local-6989586621679483382"><span class="hs-operator hs-var hs-var hs-var hs-var">+</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679483381"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483381"><span class="hs-identifier hs-var">x'</span></a></span></span><span class="annot"><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-type">:%</span></a></span><span id="local-6989586621679483380"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483380"><span class="hs-identifier hs-var">y'</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Ratio a
forall a. Integral a =&gt; a -&gt; a -&gt; Ratio a
</span><a href="GHC.Real.html#reduce"><span class="hs-identifier hs-var">reduce</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483384"><span class="hs-identifier hs-var">x</span></a></span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483380"><span class="hs-identifier hs-var">y'</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483381"><span class="hs-identifier hs-var">x'</span></a></span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483383"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483383"><span class="hs-identifier hs-var">y</span></a></span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483380"><span class="hs-identifier hs-var">y'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-498"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621679483374"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483374"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-type">:%</span></a></span><span id="local-6989586621679483373"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483373"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679483372"><span class="annot"><span class="annottext">- :: Ratio a -&gt; Ratio a -&gt; Ratio a
</span><a href="GHC.Num.html#-"><span class="hs-glyph hs-var hs-var hs-var hs-var">-</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679483371"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483371"><span class="hs-identifier hs-var">x'</span></a></span></span><span class="annot"><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-type">:%</span></a></span><span id="local-6989586621679483370"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483370"><span class="hs-identifier hs-var">y'</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Ratio a
forall a. Integral a =&gt; a -&gt; a -&gt; Ratio a
</span><a href="GHC.Real.html#reduce"><span class="hs-identifier hs-var">reduce</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483374"><span class="hs-identifier hs-var">x</span></a></span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483370"><span class="hs-identifier hs-var">y'</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483371"><span class="hs-identifier hs-var">x'</span></a></span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483373"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483373"><span class="hs-identifier hs-var">y</span></a></span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483370"><span class="hs-identifier hs-var">y'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-499"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621679483366"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483366"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-type">:%</span></a></span><span id="local-6989586621679483365"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483365"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679483364"><span class="annot"><span class="annottext">* :: Ratio a -&gt; Ratio a -&gt; Ratio a
</span><a href="#local-6989586621679483364"><span class="hs-operator hs-var hs-var hs-var hs-var">*</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679483363"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483363"><span class="hs-identifier hs-var">x'</span></a></span></span><span class="annot"><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-type">:%</span></a></span><span id="local-6989586621679483362"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483362"><span class="hs-identifier hs-var">y'</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Ratio a
forall a. Integral a =&gt; a -&gt; a -&gt; Ratio a
</span><a href="GHC.Real.html#reduce"><span class="hs-identifier hs-var">reduce</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483366"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483363"><span class="hs-identifier hs-var">x'</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483365"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483362"><span class="hs-identifier hs-var">y'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-500"></span><span>    </span><span id="local-6989586621679483360"><span class="annot"><span class="annottext">negate :: Ratio a -&gt; Ratio a
</span><a href="GHC.Num.html#negate"><span class="hs-identifier hs-var hs-var hs-var hs-var">negate</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679483359"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483359"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-type">:%</span></a></span><span id="local-6989586621679483358"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483358"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">)</span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="hs-special">(</span><span class="hs-glyph">-</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483359"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Ratio a
forall a. a -&gt; a -&gt; Ratio a
</span><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-var">:%</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483358"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-501"></span><span>    </span><span id="local-6989586621679483356"><span class="annot"><span class="annottext">abs :: Ratio a -&gt; Ratio a
</span><a href="#local-6989586621679483356"><span class="hs-identifier hs-var hs-var hs-var hs-var">abs</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679483355"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483355"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-type">:%</span></a></span><span id="local-6989586621679483354"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483354"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">)</span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">a -&gt; a
forall a. Num a =&gt; a -&gt; a
</span><a href="GHC.Num.html#abs"><span class="hs-identifier hs-var">abs</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483355"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Ratio a
forall a. a -&gt; a -&gt; Ratio a
</span><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-var">:%</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483354"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-502"></span><span>    </span><span id="local-6989586621679483351"><span class="annot"><span class="annottext">signum :: Ratio a -&gt; Ratio a
</span><a href="#local-6989586621679483351"><span class="hs-identifier hs-var hs-var hs-var hs-var">signum</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679483350"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483350"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-type">:%</span></a></span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">a -&gt; a
forall a. Num a =&gt; a -&gt; a
</span><a href="GHC.Num.html#signum"><span class="hs-identifier hs-var">signum</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483350"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Ratio a
forall a. a -&gt; a -&gt; Ratio a
</span><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-var">:%</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">1</span></span><span>
</span><span id="line-503"></span><span>    </span><span id="local-6989586621679483347"><span class="annot"><span class="annottext">fromInteger :: Integer -&gt; Ratio a
</span><a href="GHC.Num.html#fromInteger"><span class="hs-identifier hs-var hs-var hs-var hs-var">fromInteger</span></a></span></span><span> </span><span id="local-6989586621679483346"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483346"><span class="hs-identifier hs-var">x</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Integer -&gt; a
forall a. Num a =&gt; Integer -&gt; a
</span><a href="GHC.Num.html#fromInteger"><span class="hs-identifier hs-var">fromInteger</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483346"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Ratio a
forall a. a -&gt; a -&gt; Ratio a
</span><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-var">:%</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">1</span></span></span><span>
</span><span id="line-504"></span><span>
</span><span id="line-505"></span><span class="hs-comment">-- | @since 2.0.1</span><span>
</span><span id="line-506"></span><span class="hs-pragma">{-# RULES</span><span> </span><span class="annot"><span class="hs-pragma">&quot;fromRational/id&quot;</span></span><span> </span><span class="annot"><a href="GHC.Real.html#fromRational"><span class="hs-pragma hs-type">fromRational</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="GHC.Base.html#id"><span class="hs-pragma hs-type">id</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="GHC.Real.html#Rational"><span class="hs-pragma hs-type">Rational</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="GHC.Real.html#Rational"><span class="hs-pragma hs-type">Rational</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-507"></span><span id="local-6989586621679484097"><span class="hs-keyword">instance</span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Real.html#Integral"><span class="hs-identifier hs-type">Integral</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484097"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Real.html#Fractional"><span class="hs-identifier hs-type">Fractional</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Real.html#Ratio"><span class="hs-identifier hs-type">Ratio</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484097"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-508"></span><span>    </span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="hs-pragma">instance</span><span> </span><span class="annot"><a href="GHC.Real.html#Fractional"><span class="hs-pragma hs-type">Fractional</span></a></span><span> </span><span class="annot"><a href="GHC.Real.html#Rational"><span class="hs-pragma hs-type">Rational</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-509"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621679483329"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483329"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-type">:%</span></a></span><span id="local-6989586621679483328"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483328"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679483327"><span class="annot"><span class="annottext">/ :: Ratio a -&gt; Ratio a -&gt; Ratio a
</span><a href="#local-6989586621679483327"><span class="hs-operator hs-var hs-var hs-var hs-var">/</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679483326"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483326"><span class="hs-identifier hs-var">x'</span></a></span></span><span class="annot"><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-type">:%</span></a></span><span id="local-6989586621679483325"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483325"><span class="hs-identifier hs-var">y'</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span>  </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483329"><span class="hs-identifier hs-var">x</span></a></span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483325"><span class="hs-identifier hs-var">y'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Ratio a
forall a. Integral a =&gt; a -&gt; a -&gt; Ratio a
</span><a href="GHC.Real.html#%25"><span class="hs-operator hs-var">%</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483328"><span class="hs-identifier hs-var">y</span></a></span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483326"><span class="hs-identifier hs-var">x'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-510"></span><span>    </span><span id="local-6989586621679483318"><span class="annot"><span class="annottext">recip :: Ratio a -&gt; Ratio a
</span><a href="#local-6989586621679483318"><span class="hs-identifier hs-var hs-var hs-var hs-var">recip</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><span class="hs-number">0</span></span><span class="annot"><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-type">:%</span></a></span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ratio a
forall a. a
</span><a href="GHC.Real.html#ratioZeroDenominatorError"><span class="hs-identifier hs-var">ratioZeroDenominatorError</span></a></span><span>
</span><span id="line-511"></span><span>    </span><span class="annot"><a href="GHC.Real.html#recip"><span class="hs-identifier hs-var">recip</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679483317"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483317"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-type">:%</span></a></span><span id="local-6989586621679483316"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483316"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-512"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483317"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">0</span></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; a
forall a. Num a =&gt; a -&gt; a
</span><a href="GHC.Num.html#negate"><span class="hs-identifier hs-var">negate</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483316"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Ratio a
forall a. a -&gt; a -&gt; Ratio a
</span><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-var">:%</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a
forall a. Num a =&gt; a -&gt; a
</span><a href="GHC.Num.html#negate"><span class="hs-identifier hs-var">negate</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483317"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-513"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483316"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Ratio a
forall a. a -&gt; a -&gt; Ratio a
</span><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-var">:%</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483317"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-514"></span><span>    </span><span id="local-6989586621679483312"><span class="annot"><span class="annottext">fromRational :: Rational -&gt; Ratio a
</span><a href="GHC.Real.html#fromRational"><span class="hs-identifier hs-var hs-var hs-var hs-var">fromRational</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679483311"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483311"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-type">:%</span></a></span><span id="local-6989586621679483310"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483310"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Integer -&gt; a
forall a. Num a =&gt; Integer -&gt; a
</span><a href="GHC.Num.html#fromInteger"><span class="hs-identifier hs-var">fromInteger</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483311"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Ratio a
forall a. Integral a =&gt; a -&gt; a -&gt; Ratio a
</span><a href="GHC.Real.html#%25"><span class="hs-operator hs-var">%</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; a
forall a. Num a =&gt; Integer -&gt; a
</span><a href="GHC.Num.html#fromInteger"><span class="hs-identifier hs-var">fromInteger</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483310"><span class="hs-identifier hs-var">y</span></a></span></span><span>
</span><span id="line-515"></span><span>
</span><span id="line-516"></span><span class="hs-comment">-- | @since 2.0.1</span><span>
</span><span id="line-517"></span><span id="local-6989586621679484095"><span class="hs-keyword">instance</span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Real.html#Integral"><span class="hs-identifier hs-type">Integral</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484095"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Real.html#Real"><span class="hs-identifier hs-type">Real</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Real.html#Ratio"><span class="hs-identifier hs-type">Ratio</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484095"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-518"></span><span>    </span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="hs-pragma">instance</span><span> </span><span class="annot"><a href="GHC.Real.html#Real"><span class="hs-pragma hs-type">Real</span></a></span><span> </span><span class="annot"><a href="GHC.Real.html#Rational"><span class="hs-pragma hs-type">Rational</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-519"></span><span>    </span><span id="local-6989586621679483300"><span class="annot"><span class="annottext">toRational :: Ratio a -&gt; Rational
</span><a href="GHC.Real.html#toRational"><span class="hs-identifier hs-var hs-var hs-var hs-var">toRational</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679483299"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483299"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-type">:%</span></a></span><span id="local-6989586621679483298"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483298"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">a -&gt; Integer
forall a. Integral a =&gt; a -&gt; Integer
</span><a href="GHC.Real.html#toInteger"><span class="hs-identifier hs-var">toInteger</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483299"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Rational
forall a. a -&gt; a -&gt; Ratio a
</span><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-var">:%</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Integer
forall a. Integral a =&gt; a -&gt; Integer
</span><a href="GHC.Real.html#toInteger"><span class="hs-identifier hs-var">toInteger</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483298"><span class="hs-identifier hs-var">y</span></a></span></span><span>
</span><span id="line-520"></span><span>
</span><span id="line-521"></span><span class="hs-comment">-- | @since 2.0.1</span><span>
</span><span id="line-522"></span><span id="local-6989586621679484094"><span class="hs-keyword">instance</span><span>  </span><span id="local-6989586621679483286"><span id="local-6989586621679483288"><span id="local-6989586621679483291"><span class="hs-special">(</span><span class="annot"><a href="GHC.Real.html#Integral"><span class="hs-identifier hs-type">Integral</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484094"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Real.html#RealFrac"><span class="hs-identifier hs-type">RealFrac</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Real.html#Ratio"><span class="hs-identifier hs-type">Ratio</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484094"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-523"></span><span>    </span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="hs-pragma">instance</span><span> </span><span class="annot"><a href="GHC.Real.html#RealFrac"><span class="hs-pragma hs-type">RealFrac</span></a></span><span> </span><span class="annot"><a href="GHC.Real.html#Rational"><span class="hs-pragma hs-type">Rational</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-524"></span><span>    </span><span id="local-6989586621679483279"><span class="annot"><span class="annottext">properFraction :: forall b. Integral b =&gt; Ratio a -&gt; (b, Ratio a)
</span><a href="#local-6989586621679483279"><span class="hs-identifier hs-var hs-var hs-var hs-var">properFraction</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679483278"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483278"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-type">:%</span></a></span><span id="local-6989586621679483277"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483277"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; b
forall a. Num a =&gt; Integer -&gt; a
</span><a href="GHC.Num.html#fromInteger"><span class="hs-identifier hs-var">fromInteger</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Integer
forall a. Integral a =&gt; a -&gt; Integer
</span><a href="GHC.Real.html#toInteger"><span class="hs-identifier hs-var">toInteger</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483276"><span class="hs-identifier hs-var">q</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483275"><span class="hs-identifier hs-var">r</span></a></span><span class="annot"><span class="annottext">a -&gt; a -&gt; Ratio a
forall a. a -&gt; a -&gt; Ratio a
</span><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-var">:%</span></a></span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483277"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-525"></span><span>                          </span><span class="hs-keyword">where</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679483276"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483276"><span class="hs-identifier hs-var">q</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679483275"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483275"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; (a, a)
forall a. Integral a =&gt; a -&gt; a -&gt; (a, a)
</span><a href="GHC.Real.html#quotRem"><span class="hs-identifier hs-var">quotRem</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483278"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483277"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-526"></span><span>    </span><span id="local-6989586621679483264"><span class="annot"><span class="annottext">round :: forall b. Integral b =&gt; Ratio a -&gt; b
</span><a href="#local-6989586621679483264"><span class="hs-identifier hs-var hs-var hs-var hs-var">round</span></a></span></span><span> </span><span id="local-6989586621679483263"><span class="annot"><span class="annottext">Ratio a
</span><a href="#local-6989586621679483263"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-527"></span><span>      </span><span class="hs-keyword">let</span><span>
</span><span id="line-528"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621679483259"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679483259"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679483258"><span class="annot"><span class="annottext">Ratio a
</span><a href="#local-6989586621679483258"><span class="hs-identifier hs-var">f</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ratio a -&gt; (b, Ratio a)
forall a b. (RealFrac a, Integral b) =&gt; a -&gt; (b, a)
</span><a href="GHC.Real.html#properFraction"><span class="hs-identifier hs-var">properFraction</span></a></span><span> </span><span class="annot"><span class="annottext">Ratio a
</span><a href="#local-6989586621679483263"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-529"></span><span>        </span><span id="local-6989586621679483251"><span class="annot"><span class="annottext">x :: b
</span><a href="#local-6989586621679483251"><span class="hs-identifier hs-var hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Ratio a
</span><a href="#local-6989586621679483263"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Ratio a -&gt; Ratio a -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Ratio a
</span><span class="hs-number">0</span></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="hs-glyph">-</span><span class="annot"><span class="annottext">b
</span><span class="hs-number">1</span></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">b
</span><span class="hs-number">1</span></span><span>
</span><span id="line-530"></span><span>      </span><span class="hs-keyword">in</span><span>
</span><span id="line-531"></span><span>        </span><span class="hs-keyword">case</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ratio a -&gt; Ratio a -&gt; Ordering
forall a. Ord a =&gt; a -&gt; a -&gt; Ordering
</span><a href="../../ghc-prim/src/GHC.Classes.html#compare"><span class="hs-identifier hs-var">compare</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ratio a -&gt; Ratio a
forall a. Num a =&gt; a -&gt; a
</span><a href="GHC.Num.html#abs"><span class="hs-identifier hs-var">abs</span></a></span><span> </span><span class="annot"><span class="annottext">Ratio a
</span><a href="#local-6989586621679483258"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Ratio a
</span><span class="hs-number">0.5</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">b -&gt; Bool
forall a. Integral a =&gt; a -&gt; Bool
</span><a href="GHC.Real.html#odd"><span class="hs-identifier hs-var">odd</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679483259"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-532"></span><span>          </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ordering
</span><a href="../../ghc-prim/src/GHC.Types.html#LT"><span class="hs-identifier hs-var">LT</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679483259"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-533"></span><span>          </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ordering
</span><a href="../../ghc-prim/src/GHC.Types.html#EQ"><span class="hs-identifier hs-var">EQ</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#False"><span class="hs-identifier hs-var">False</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679483259"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-534"></span><span>          </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ordering
</span><a href="../../ghc-prim/src/GHC.Types.html#EQ"><span class="hs-identifier hs-var">EQ</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#True"><span class="hs-identifier hs-var">True</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679483259"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">b -&gt; b -&gt; b
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679483251"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-535"></span><span>          </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ordering
</span><a href="../../ghc-prim/src/GHC.Types.html#GT"><span class="hs-identifier hs-var">GT</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679483259"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">b -&gt; b -&gt; b
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679483251"><span class="hs-identifier hs-var">x</span></a></span></span><span>
</span><span id="line-536"></span><span>
</span><span id="line-537"></span><span class="hs-comment">-- | @since 2.0.1</span><span>
</span><span id="line-538"></span><span id="local-6989586621679484089"><span class="hs-keyword">instance</span><span>  </span><span id="local-6989586621679483244"><span id="local-6989586621679483246"><span class="hs-special">(</span><span class="annot"><a href="GHC.Show.html#Show"><span class="hs-identifier hs-type">Show</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484089"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Show.html#Show"><span class="hs-identifier hs-type">Show</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Real.html#Ratio"><span class="hs-identifier hs-type">Ratio</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484089"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-539"></span><span>    </span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="hs-pragma">instance</span><span> </span><span class="annot"><a href="GHC.Show.html#Show"><span class="hs-pragma hs-type">Show</span></a></span><span> </span><span class="annot"><a href="GHC.Real.html#Rational"><span class="hs-pragma hs-type">Rational</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-540"></span><span>    </span><span id="local-6989586621679483239"><span class="annot"><span class="annottext">showsPrec :: Int -&gt; Ratio a -&gt; ShowS
</span><a href="GHC.Show.html#showsPrec"><span class="hs-identifier hs-var hs-var hs-var hs-var">showsPrec</span></a></span></span><span> </span><span id="local-6989586621679483237"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483237"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679483236"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483236"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-type">:%</span></a></span><span id="local-6989586621679483235"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483235"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Bool -&gt; ShowS -&gt; ShowS
</span><a href="GHC.Show.html#showParen"><span class="hs-identifier hs-var">showParen</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483237"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E"><span class="hs-operator hs-var">&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="GHC.Real.html#ratioPrec"><span class="hs-identifier hs-var">ratioPrec</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(ShowS -&gt; ShowS) -&gt; ShowS -&gt; ShowS
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-541"></span><span>                           </span><span class="annot"><span class="annottext">Int -&gt; a -&gt; ShowS
forall a. Show a =&gt; Int -&gt; a -&gt; ShowS
</span><a href="GHC.Show.html#showsPrec"><span class="hs-identifier hs-var">showsPrec</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="GHC.Real.html#ratioPrec1"><span class="hs-identifier hs-var">ratioPrec1</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483236"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span>
</span><span id="line-542"></span><span>                           </span><span class="annot"><span class="annottext">[Char] -&gt; ShowS
</span><a href="GHC.Show.html#showString"><span class="hs-identifier hs-var">showString</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot; % &quot;</span></span><span> </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span>
</span><span id="line-543"></span><span>                           </span><span class="hs-comment">-- H98 report has spaces round the %</span><span>
</span><span id="line-544"></span><span>                           </span><span class="hs-comment">-- but we removed them [May 04]</span><span>
</span><span id="line-545"></span><span>                           </span><span class="hs-comment">-- and added them again for consistency with</span><span>
</span><span id="line-546"></span><span>                           </span><span class="hs-comment">-- Haskell 98 [Sep 08, #1920]</span><span>
</span><span id="line-547"></span><span>                           </span><span class="annot"><span class="annottext">Int -&gt; a -&gt; ShowS
forall a. Show a =&gt; Int -&gt; a -&gt; ShowS
</span><a href="GHC.Show.html#showsPrec"><span class="hs-identifier hs-var">showsPrec</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="GHC.Real.html#ratioPrec1"><span class="hs-identifier hs-var">ratioPrec1</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483235"><span class="hs-identifier hs-var">y</span></a></span></span><span>
</span><span id="line-548"></span><span>
</span><span id="line-549"></span><span class="hs-comment">-- | @since 2.0.1</span><span>
</span><span id="line-550"></span><span id="local-6989586621679484080"><span class="hs-keyword">instance</span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Real.html#Integral"><span class="hs-identifier hs-type">Integral</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484080"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Enum.html#Enum"><span class="hs-identifier hs-type">Enum</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Real.html#Ratio"><span class="hs-identifier hs-type">Ratio</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484080"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-551"></span><span>    </span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="hs-pragma">instance</span><span> </span><span class="annot"><a href="GHC.Enum.html#Enum"><span class="hs-pragma hs-type">Enum</span></a></span><span> </span><span class="annot"><a href="GHC.Real.html#Rational"><span class="hs-pragma hs-type">Rational</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-552"></span><span>    </span><span id="local-6989586621679483216"><span class="annot"><span class="annottext">succ :: Ratio a -&gt; Ratio a
</span><a href="GHC.Enum.html#succ"><span class="hs-identifier hs-var hs-var hs-var hs-var">succ</span></a></span></span><span> </span><span id="local-6989586621679483214"><span class="annot"><span class="annottext">Ratio a
</span><a href="#local-6989586621679483214"><span class="hs-identifier hs-var">x</span></a></span></span><span>              </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Ratio a
</span><a href="#local-6989586621679483214"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Ratio a -&gt; Ratio a -&gt; Ratio a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Ratio a
</span><span class="hs-number">1</span></span><span>
</span><span id="line-553"></span><span>    </span><span id="local-6989586621679483211"><span class="annot"><span class="annottext">pred :: Ratio a -&gt; Ratio a
</span><a href="GHC.Enum.html#pred"><span class="hs-identifier hs-var hs-var hs-var hs-var">pred</span></a></span></span><span> </span><span id="local-6989586621679483209"><span class="annot"><span class="annottext">Ratio a
</span><a href="#local-6989586621679483209"><span class="hs-identifier hs-var">x</span></a></span></span><span>              </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Ratio a
</span><a href="#local-6989586621679483209"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Ratio a -&gt; Ratio a -&gt; Ratio a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Ratio a
</span><span class="hs-number">1</span></span><span>
</span><span id="line-554"></span><span>
</span><span id="line-555"></span><span>    </span><span id="local-6989586621679483205"><span class="annot"><span class="annottext">toEnum :: Int -&gt; Ratio a
</span><a href="GHC.Enum.html#toEnum"><span class="hs-identifier hs-var hs-var hs-var hs-var">toEnum</span></a></span></span><span> </span><span id="local-6989586621679483203"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483203"><span class="hs-identifier hs-var">n</span></a></span></span><span>            </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Int -&gt; a
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483203"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Ratio a
forall a. a -&gt; a -&gt; Ratio a
</span><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-var">:%</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">1</span></span><span>
</span><span id="line-556"></span><span>    </span><span id="local-6989586621679483199"><span class="annot"><span class="annottext">fromEnum :: Ratio a -&gt; Int
</span><a href="GHC.Enum.html#fromEnum"><span class="hs-identifier hs-var hs-var hs-var hs-var">fromEnum</span></a></span></span><span>            </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Integer -&gt; Int
forall a. Num a =&gt; Integer -&gt; a
</span><a href="GHC.Num.html#fromInteger"><span class="hs-identifier hs-var">fromInteger</span></a></span><span> </span><span class="annot"><span class="annottext">(Integer -&gt; Int) -&gt; (Ratio a -&gt; Integer) -&gt; Ratio a -&gt; Int
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Ratio a -&gt; Integer
forall a b. (RealFrac a, Integral b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#truncate"><span class="hs-identifier hs-var">truncate</span></a></span><span>
</span><span id="line-557"></span><span>
</span><span id="line-558"></span><span>    </span><span id="local-6989586621679483196"><span class="annot"><span class="annottext">enumFrom :: Ratio a -&gt; [Ratio a]
</span><a href="GHC.Enum.html#enumFrom"><span class="hs-identifier hs-var hs-var hs-var hs-var">enumFrom</span></a></span></span><span>            </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Ratio a -&gt; [Ratio a]
forall a. Fractional a =&gt; a -&gt; [a]
</span><a href="GHC.Real.html#numericEnumFrom"><span class="hs-identifier hs-var">numericEnumFrom</span></a></span><span>
</span><span id="line-559"></span><span>    </span><span id="local-6989586621679483194"><span class="annot"><span class="annottext">enumFromThen :: Ratio a -&gt; Ratio a -&gt; [Ratio a]
</span><a href="GHC.Enum.html#enumFromThen"><span class="hs-identifier hs-var hs-var hs-var hs-var">enumFromThen</span></a></span></span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Ratio a -&gt; Ratio a -&gt; [Ratio a]
forall a. Fractional a =&gt; a -&gt; a -&gt; [a]
</span><a href="GHC.Real.html#numericEnumFromThen"><span class="hs-identifier hs-var">numericEnumFromThen</span></a></span><span>
</span><span id="line-560"></span><span>    </span><span id="local-6989586621679483191"><span class="annot"><span class="annottext">enumFromTo :: Ratio a -&gt; Ratio a -&gt; [Ratio a]
</span><a href="GHC.Enum.html#enumFromTo"><span class="hs-identifier hs-var hs-var hs-var hs-var">enumFromTo</span></a></span></span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Ratio a -&gt; Ratio a -&gt; [Ratio a]
forall a. (Ord a, Fractional a) =&gt; a -&gt; a -&gt; [a]
</span><a href="GHC.Real.html#numericEnumFromTo"><span class="hs-identifier hs-var">numericEnumFromTo</span></a></span><span>
</span><span id="line-561"></span><span>    </span><span id="local-6989586621679483188"><span class="annot"><span class="annottext">enumFromThenTo :: Ratio a -&gt; Ratio a -&gt; Ratio a -&gt; [Ratio a]
</span><a href="GHC.Enum.html#enumFromThenTo"><span class="hs-identifier hs-var hs-var hs-var hs-var">enumFromThenTo</span></a></span></span><span>      </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Ratio a -&gt; Ratio a -&gt; Ratio a -&gt; [Ratio a]
forall a. (Ord a, Fractional a) =&gt; a -&gt; a -&gt; a -&gt; [a]
</span><a href="GHC.Real.html#numericEnumFromThenTo"><span class="hs-identifier hs-var">numericEnumFromThenTo</span></a></span></span><span>
</span><span id="line-562"></span><span>
</span><span id="line-563"></span><span class="hs-comment">--------------------------------------------------------------</span><span>
</span><span id="line-564"></span><span class="hs-comment">-- Coercions</span><span>
</span><span id="line-565"></span><span class="hs-comment">--------------------------------------------------------------</span><span>
</span><span id="line-566"></span><span>
</span><span id="line-567"></span><span class="hs-comment">-- | general coercion from integral types</span><span>
</span><span id="line-568"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.Real.html#fromIntegral"><span class="hs-pragma hs-type">fromIntegral</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-569"></span><span id="local-6989586621679484078"><span id="local-6989586621679484079"><span class="annot"><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-type">fromIntegral</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Real.html#Integral"><span class="hs-identifier hs-type">Integral</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484079"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Num.html#Num"><span class="hs-identifier hs-type">Num</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484078"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484079"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484078"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-570"></span><span id="fromIntegral"><span class="annot"><span class="annottext">fromIntegral :: forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var hs-var">fromIntegral</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; b
forall a. Num a =&gt; Integer -&gt; a
</span><a href="GHC.Num.html#fromInteger"><span class="hs-identifier hs-var">fromInteger</span></a></span><span> </span><span class="annot"><span class="annottext">(Integer -&gt; b) -&gt; (a -&gt; Integer) -&gt; a -&gt; b
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Integer
forall a. Integral a =&gt; a -&gt; Integer
</span><a href="GHC.Real.html#toInteger"><span class="hs-identifier hs-var">toInteger</span></a></span><span>
</span><span id="line-571"></span><span>
</span><span id="line-572"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-573"></span><span class="annot"><span class="hs-pragma">&quot;fromIntegral/Int-&gt;Int&quot;</span></span><span> </span><span class="annot"><a href="GHC.Real.html#fromIntegral"><span class="hs-pragma hs-type">fromIntegral</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="GHC.Base.html#id"><span class="hs-pragma hs-type">id</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-pragma hs-type">Int</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-pragma hs-type">Int</span></a></span><span>
</span><span id="line-574"></span><span>    </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-575"></span><span>
</span><span id="line-576"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-577"></span><span class="annot"><span class="hs-pragma">&quot;fromIntegral/Int-&gt;Word&quot;</span></span><span>  </span><span class="annot"><a href="GHC.Real.html#fromIntegral"><span class="hs-pragma hs-type">fromIntegral</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="hs-pragma">\</span><span class="hs-pragma">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-pragma hs-type">I#</span></a></span><span> </span><span id="local-6989586621679483183"><span class="annot"><a href="#local-6989586621679483183"><span class="hs-pragma hs-var">x#</span></a></span></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-pragma hs-type">W#</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#int2Word%23"><span class="hs-pragma hs-type">int2Word#</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679483183"><span class="hs-pragma hs-type">x#</span></a></span><span class="hs-pragma">)</span><span>
</span><span id="line-578"></span><span class="annot"><span class="hs-pragma">&quot;fromIntegral/Word-&gt;Int&quot;</span></span><span>  </span><span class="annot"><a href="GHC.Real.html#fromIntegral"><span class="hs-pragma hs-type">fromIntegral</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="hs-pragma">\</span><span class="hs-pragma">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-pragma hs-type">W#</span></a></span><span> </span><span id="local-6989586621679483182"><span class="annot"><a href="#local-6989586621679483182"><span class="hs-pragma hs-var">x#</span></a></span></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-pragma hs-type">I#</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#word2Int%23"><span class="hs-pragma hs-type">word2Int#</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679483182"><span class="hs-pragma hs-type">x#</span></a></span><span class="hs-pragma">)</span><span>
</span><span id="line-579"></span><span class="annot"><span class="hs-pragma">&quot;fromIntegral/Word-&gt;Word&quot;</span></span><span> </span><span class="annot"><a href="GHC.Real.html#fromIntegral"><span class="hs-pragma hs-type">fromIntegral</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="GHC.Base.html#id"><span class="hs-pragma hs-type">id</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Word"><span class="hs-pragma hs-type">Word</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Word"><span class="hs-pragma hs-type">Word</span></a></span><span>
</span><span id="line-580"></span><span>    </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-581"></span><span>
</span><span id="line-582"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-583"></span><span class="annot"><span class="hs-pragma">&quot;fromIntegral/Natural-&gt;Natural&quot;</span></span><span>  </span><span class="annot"><a href="GHC.Real.html#fromIntegral"><span class="hs-pragma hs-type">fromIntegral</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="GHC.Base.html#id"><span class="hs-pragma hs-type">id</span></a></span><span>            </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Natural.html#Natural"><span class="hs-pragma hs-type">Natural</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Natural.html#Natural"><span class="hs-pragma hs-type">Natural</span></a></span><span>
</span><span id="line-584"></span><span class="annot"><span class="hs-pragma">&quot;fromIntegral/Natural-&gt;Integer&quot;</span></span><span>  </span><span class="annot"><a href="GHC.Real.html#fromIntegral"><span class="hs-pragma hs-type">fromIntegral</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="GHC.Real.html#toInteger"><span class="hs-pragma hs-type">toInteger</span></a></span><span>     </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Natural.html#Natural"><span class="hs-pragma hs-type">Natural</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-pragma hs-type">Integer</span></a></span><span>
</span><span id="line-585"></span><span class="annot"><span class="hs-pragma">&quot;fromIntegral/Natural-&gt;Word&quot;</span></span><span>     </span><span class="annot"><a href="GHC.Real.html#fromIntegral"><span class="hs-pragma hs-type">fromIntegral</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Natural.html#naturalToWord"><span class="hs-pragma hs-type">naturalToWord</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Natural.html#Natural"><span class="hs-pragma hs-type">Natural</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Word"><span class="hs-pragma hs-type">Word</span></a></span><span>
</span><span id="line-586"></span><span>  </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-587"></span><span>
</span><span id="line-588"></span><span class="hs-comment">-- Don't forget the type signatures in the following rules! Without a type</span><span>
</span><span id="line-589"></span><span class="hs-comment">-- signature we ended up with the rule:</span><span>
</span><span id="line-590"></span><span class="hs-comment">--</span><span>
</span><span id="line-591"></span><span class="hs-comment">--  &quot;fromIntegral/Int-&gt;Natural&quot; forall a (d::Integral a).</span><span>
</span><span id="line-592"></span><span class="hs-comment">--        fromIntegral @a @Natural = naturalFromWord . fromIntegral @a d</span><span>
</span><span id="line-593"></span><span class="hs-comment">--</span><span>
</span><span id="line-594"></span><span class="hs-comment">-- but this rule is certainly not valid for every Integral type a!</span><span>
</span><span id="line-595"></span><span class="hs-comment">--</span><span>
</span><span id="line-596"></span><span class="hs-comment">-- This rule wraps any Integral input into Word's range. As a consequence,</span><span>
</span><span id="line-597"></span><span class="hs-comment">-- (2^64 :: Integer) was incorrectly wrapped to (0 :: Natural), see #19345.</span><span>
</span><span id="line-598"></span><span class="hs-comment">--</span><span>
</span><span id="line-599"></span><span class="hs-comment">-- A follow-up issue with this rule was that no underflow exception was raised</span><span>
</span><span id="line-600"></span><span class="hs-comment">-- for negative Int values (see #20066). We now use a naturalFromInt helper</span><span>
</span><span id="line-601"></span><span class="hs-comment">-- function to restore this behavior.</span><span>
</span><span id="line-602"></span><span>
</span><span id="line-603"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-604"></span><span class="annot"><span class="hs-pragma">&quot;fromIntegral/Word-&gt;Natural&quot;</span></span><span>    </span><span class="annot"><a href="GHC.Real.html#fromIntegral"><span class="hs-pragma hs-type">fromIntegral</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Natural.html#naturalFromWord"><span class="hs-pragma hs-type">naturalFromWord</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Word"><span class="hs-pragma hs-type">Word</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Natural.html#Natural"><span class="hs-pragma hs-type">Natural</span></a></span><span>
</span><span id="line-605"></span><span class="annot"><span class="hs-pragma">&quot;fromIntegral/Int-&gt;Natural&quot;</span></span><span>     </span><span class="annot"><a href="GHC.Real.html#fromIntegral"><span class="hs-pragma hs-type">fromIntegral</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="GHC.Real.html#naturalFromInt"><span class="hs-pragma hs-type">naturalFromInt</span></a></span><span>  </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-pragma hs-type">Int</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Natural.html#Natural"><span class="hs-pragma hs-type">Natural</span></a></span><span>
</span><span id="line-606"></span><span>  </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-607"></span><span>
</span><span id="line-608"></span><span class="hs-comment">-- | Convert an Int into a Natural, throwing an underflow exception for negative</span><span>
</span><span id="line-609"></span><span class="hs-comment">-- values.</span><span>
</span><span id="line-610"></span><span class="annot"><a href="GHC.Real.html#naturalFromInt"><span class="hs-identifier hs-type">naturalFromInt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Natural.html#Natural"><span class="hs-identifier hs-type">Natural</span></a></span><span>
</span><span id="line-611"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Real.html#naturalFromInt"><span class="hs-pragma hs-type">naturalFromInt</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-612"></span><span id="naturalFromInt"><span class="annot"><span class="annottext">naturalFromInt :: Int -&gt; Natural
</span><a href="GHC.Real.html#naturalFromInt"><span class="hs-identifier hs-var hs-var">naturalFromInt</span></a></span></span><span> </span><span id="local-6989586621679483178"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483178"><span class="hs-identifier hs-var">x</span></a></span></span><span>
</span><span id="line-613"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483178"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Natural
forall a. a
</span><a href="GHC.Real.html#underflowError"><span class="hs-identifier hs-var">underflowError</span></a></span><span>
</span><span id="line-614"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word -&gt; Natural
</span><a href="../../ghc-bignum/src/GHC.Num.Natural.html#naturalFromWord"><span class="hs-identifier hs-var">naturalFromWord</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Word
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483178"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-615"></span><span>
</span><span id="line-616"></span><span class="hs-comment">-- | general coercion to fractional types</span><span>
</span><span id="line-617"></span><span id="local-6989586621679484074"><span id="local-6989586621679484075"><span class="annot"><a href="GHC.Real.html#realToFrac"><span class="hs-identifier hs-type">realToFrac</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Real.html#Real"><span class="hs-identifier hs-type">Real</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484075"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Real.html#Fractional"><span class="hs-identifier hs-type">Fractional</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484074"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484075"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484074"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-618"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.Real.html#realToFrac"><span class="hs-pragma hs-type">realToFrac</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-619"></span><span id="realToFrac"><span class="annot"><span class="annottext">realToFrac :: forall a b. (Real a, Fractional b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#realToFrac"><span class="hs-identifier hs-var hs-var">realToFrac</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Rational -&gt; b
forall a. Fractional a =&gt; Rational -&gt; a
</span><a href="GHC.Real.html#fromRational"><span class="hs-identifier hs-var">fromRational</span></a></span><span> </span><span class="annot"><span class="annottext">(Rational -&gt; b) -&gt; (a -&gt; Rational) -&gt; a -&gt; b
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Rational
forall a. Real a =&gt; a -&gt; Rational
</span><a href="GHC.Real.html#toRational"><span class="hs-identifier hs-var">toRational</span></a></span><span>
</span><span id="line-620"></span><span>
</span><span id="line-621"></span><span class="hs-comment">--------------------------------------------------------------</span><span>
</span><span id="line-622"></span><span class="hs-comment">-- Overloaded numeric functions</span><span>
</span><span id="line-623"></span><span class="hs-comment">--------------------------------------------------------------</span><span>
</span><span id="line-624"></span><span>
</span><span id="line-625"></span><span class="hs-comment">-- | Converts a possibly-negative 'Real' value to a string.</span><span>
</span><span id="line-626"></span><span id="local-6989586621679484071"><span class="annot"><a href="GHC.Real.html#showSigned"><span class="hs-identifier hs-type">showSigned</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Real.html#Real"><span class="hs-identifier hs-type">Real</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484071"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-627"></span><span>  </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679484071"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Show.html#ShowS"><span class="hs-identifier hs-type">ShowS</span></a></span><span class="hs-special">)</span><span>       </span><span class="hs-comment">-- ^ a function that can show unsigned values</span><span>
</span><span id="line-628"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>                </span><span class="hs-comment">-- ^ the precedence of the enclosing context</span><span>
</span><span id="line-629"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484071"><span class="hs-identifier hs-type">a</span></a></span><span>                  </span><span class="hs-comment">-- ^ the value to show</span><span>
</span><span id="line-630"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Show.html#ShowS"><span class="hs-identifier hs-type">ShowS</span></a></span></span><span>
</span><span id="line-631"></span><span id="showSigned"><span class="annot"><span class="annottext">showSigned :: forall a. Real a =&gt; (a -&gt; ShowS) -&gt; Int -&gt; a -&gt; ShowS
</span><a href="GHC.Real.html#showSigned"><span class="hs-identifier hs-var hs-var">showSigned</span></a></span></span><span> </span><span id="local-6989586621679483164"><span class="annot"><span class="annottext">a -&gt; ShowS
</span><a href="#local-6989586621679483164"><span class="hs-identifier hs-var">showPos</span></a></span></span><span> </span><span id="local-6989586621679483163"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483163"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679483162"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483162"><span class="hs-identifier hs-var">x</span></a></span></span><span>
</span><span id="line-632"></span><span>   </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483162"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">0</span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; ShowS -&gt; ShowS
</span><a href="GHC.Show.html#showParen"><span class="hs-identifier hs-var">showParen</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679483163"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E"><span class="hs-operator hs-var">&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">6</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; ShowS
</span><a href="GHC.Show.html#showChar"><span class="hs-identifier hs-var">showChar</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'-'</span></span><span> </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; ShowS
</span><a href="#local-6989586621679483164"><span class="hs-identifier hs-var">showPos</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">-</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483162"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-633"></span><span>   </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; ShowS
</span><a href="#local-6989586621679483164"><span class="hs-identifier hs-var">showPos</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483162"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-634"></span><span>
</span><span id="line-635"></span><span id="local-6989586621679484116"><span class="annot"><a href="GHC.Real.html#even"><span class="hs-identifier hs-type">even</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Real.html#odd"><span class="hs-identifier hs-type">odd</span></a></span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Real.html#Integral"><span class="hs-identifier hs-type">Integral</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484116"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484116"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span></span><span>
</span><span id="line-636"></span><span id="even"><span class="annot"><span class="annottext">even :: forall a. Integral a =&gt; a -&gt; Bool
</span><a href="GHC.Real.html#even"><span class="hs-identifier hs-var hs-var">even</span></a></span></span><span> </span><span id="local-6989586621679483151"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483151"><span class="hs-identifier hs-var">n</span></a></span></span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483151"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Real.html#rem"><span class="hs-operator hs-var">`rem`</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">2</span></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">0</span></span><span>
</span><span id="line-637"></span><span id="odd"><span class="annot"><span class="annottext">odd :: forall a. Integral a =&gt; a -&gt; Bool
</span><a href="GHC.Real.html#odd"><span class="hs-identifier hs-var hs-var">odd</span></a></span></span><span>             </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#not"><span class="hs-identifier hs-var">not</span></a></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; (a -&gt; Bool) -&gt; a -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
forall a. Integral a =&gt; a -&gt; Bool
</span><a href="GHC.Real.html#even"><span class="hs-identifier hs-var">even</span></a></span><span>
</span><span id="line-638"></span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="GHC.Real.html#even"><span class="hs-pragma hs-type">even</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-639"></span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="GHC.Real.html#odd"><span class="hs-pragma hs-type">odd</span></a></span><span>  </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-640"></span><span>
</span><span id="line-641"></span><span class="hs-comment">-------------------------------------------------------</span><span>
</span><span id="line-642"></span><span class="hs-comment">-- | raise a number to a non-negative integral power</span><span>
</span><span id="line-643"></span><span class="hs-pragma">{-# SPECIALISE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">^</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">::</span><span>
</span><span id="line-644"></span><span>        </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-pragma hs-type">Integer</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-pragma hs-type">Integer</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-pragma hs-type">Integer</span></a></span><span class="hs-pragma">,</span><span>
</span><span id="line-645"></span><span>        </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-pragma hs-type">Integer</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-pragma hs-type">Int</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-pragma hs-type">Integer</span></a></span><span class="hs-pragma">,</span><span>
</span><span id="line-646"></span><span>        </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-pragma hs-type">Int</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-pragma hs-type">Int</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-pragma hs-type">Int</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-647"></span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">^</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">#-}</span><span>    </span><span class="hs-comment">-- See Note [Inlining (^)]</span><span>
</span><span id="line-648"></span><span id="local-6989586621679484066"><span id="local-6989586621679484067"><span class="annot"><a href="GHC.Real.html#%5E"><span class="hs-operator hs-type">(^)</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Num.html#Num"><span class="hs-identifier hs-type">Num</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484067"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Real.html#Integral"><span class="hs-identifier hs-type">Integral</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484066"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484067"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484066"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484067"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-649"></span><span id="local-6989586621679483134"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483134"><span class="hs-identifier hs-var">x0</span></a></span></span><span> </span><span id="%5E"><span class="annot"><span class="annottext">^ :: forall a b. (Num a, Integral b) =&gt; a -&gt; b -&gt; a
</span><a href="GHC.Real.html#%5E"><span class="hs-operator hs-var hs-var">^</span></a></span></span><span> </span><span id="local-6989586621679483133"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679483133"><span class="hs-identifier hs-var">y0</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679483133"><span class="hs-identifier hs-var">y0</span></a></span><span> </span><span class="annot"><span class="annottext">b -&gt; b -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><span class="hs-number">0</span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; a
forall a. [Char] -&gt; a
</span><a href="GHC.Err.html#errorWithoutStackTrace"><span class="hs-identifier hs-var">errorWithoutStackTrace</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;Negative exponent&quot;</span></span><span>
</span><span id="line-650"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679483133"><span class="hs-identifier hs-var">y0</span></a></span><span> </span><span class="annot"><span class="annottext">b -&gt; b -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><span class="hs-number">0</span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">1</span></span><span>
</span><span id="line-651"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; a
forall {a} {a}. (Integral a, Num a) =&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679483132"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483134"><span class="hs-identifier hs-var">x0</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679483133"><span class="hs-identifier hs-var">y0</span></a></span><span>
</span><span id="line-652"></span><span>    </span><span class="hs-keyword">where</span><span> </span><span class="hs-comment">-- f : x0 ^ y0 = x ^ y</span><span>
</span><span id="line-653"></span><span>          </span><span id="local-6989586621679483132"><span class="annot"><span class="annottext">f :: a -&gt; a -&gt; a
</span><a href="#local-6989586621679483132"><span class="hs-identifier hs-var hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679483114"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483114"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679483113"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483113"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
forall a. Integral a =&gt; a -&gt; Bool
</span><a href="GHC.Real.html#even"><span class="hs-identifier hs-var">even</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483113"><span class="hs-identifier hs-var">y</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679483132"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483114"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483114"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483113"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Real.html#quot"><span class="hs-operator hs-var">`quot`</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">2</span></span><span class="hs-special">)</span><span>
</span><span id="line-654"></span><span>                </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483113"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">1</span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483114"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-655"></span><span>                </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a -&gt; a
forall {a} {a}. (Integral a, Num a) =&gt; a -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679483112"><span class="hs-identifier hs-var">g</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483114"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483114"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483113"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Real.html#quot"><span class="hs-operator hs-var">`quot`</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">2</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483114"><span class="hs-identifier hs-var">x</span></a></span><span>         </span><span class="hs-comment">-- See Note [Half of y - 1]</span><span>
</span><span id="line-656"></span><span>          </span><span class="hs-comment">-- g : x0 ^ y0 = (x ^ y) * z</span><span>
</span><span id="line-657"></span><span>          </span><span id="local-6989586621679483112"><span class="annot"><span class="annottext">g :: a -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679483112"><span class="hs-identifier hs-var hs-var">g</span></a></span></span><span> </span><span id="local-6989586621679483094"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483094"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679483093"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483093"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679483092"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483092"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
forall a. Integral a =&gt; a -&gt; Bool
</span><a href="GHC.Real.html#even"><span class="hs-identifier hs-var">even</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483093"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679483112"><span class="hs-identifier hs-var">g</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483094"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483094"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483093"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Real.html#quot"><span class="hs-operator hs-var">`quot`</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">2</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483092"><span class="hs-identifier hs-var">z</span></a></span><span>
</span><span id="line-658"></span><span>                  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483093"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">1</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483094"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483092"><span class="hs-identifier hs-var">z</span></a></span><span>
</span><span id="line-659"></span><span>                  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679483112"><span class="hs-identifier hs-var">g</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483094"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483094"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483093"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Real.html#quot"><span class="hs-operator hs-var">`quot`</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">2</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483094"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483092"><span class="hs-identifier hs-var">z</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- See Note [Half of y - 1]</span><span>
</span><span id="line-660"></span><span>
</span><span id="line-661"></span><span class="hs-comment">-- | raise a number to an integral power</span><span>
</span><span id="line-662"></span><span id="local-6989586621679484058"><span id="local-6989586621679484059"><span class="annot"><a href="GHC.Real.html#%5E%5E"><span class="hs-operator hs-type">(^^)</span></a></span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Real.html#Fractional"><span class="hs-identifier hs-type">Fractional</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484059"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Real.html#Integral"><span class="hs-identifier hs-type">Integral</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484058"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484059"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484058"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484059"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-663"></span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">^^</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">#-}</span><span>         </span><span class="hs-comment">-- See Note [Inlining (^)</span><span>
</span><span id="line-664"></span><span id="local-6989586621679483077"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483077"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="%5E%5E"><span class="annot"><span class="annottext">^^ :: forall a b. (Fractional a, Integral b) =&gt; a -&gt; b -&gt; a
</span><a href="GHC.Real.html#%5E%5E"><span class="hs-operator hs-var hs-var">^^</span></a></span></span><span> </span><span id="local-6989586621679483076"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679483076"><span class="hs-identifier hs-var">n</span></a></span></span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679483076"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">b -&gt; b -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><span class="hs-number">0</span></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483077"><span class="hs-identifier hs-var">x</span></a></span><span class="annot"><span class="annottext">a -&gt; b -&gt; a
forall a b. (Num a, Integral b) =&gt; a -&gt; b -&gt; a
</span><a href="GHC.Real.html#%5E"><span class="hs-operator hs-var">^</span></a></span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679483076"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">a -&gt; a
forall a. Fractional a =&gt; a -&gt; a
</span><a href="GHC.Real.html#recip"><span class="hs-identifier hs-var">recip</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483077"><span class="hs-identifier hs-var">x</span></a></span><span class="annot"><span class="annottext">a -&gt; b -&gt; a
forall a b. (Num a, Integral b) =&gt; a -&gt; b -&gt; a
</span><a href="GHC.Real.html#%5E"><span class="hs-operator hs-var">^</span></a></span><span class="hs-special">(</span><span class="annot"><span class="annottext">b -&gt; b
forall a. Num a =&gt; a -&gt; a
</span><a href="GHC.Num.html#negate"><span class="hs-identifier hs-var">negate</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679483076"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-665"></span><span>
</span><span id="line-666"></span><span class="hs-comment">{- Note [Half of y - 1]
   ~~~~~~~~~~~~~~~~~~~~~
   Since y is guaranteed to be odd and positive here,
   half of y - 1 can be computed as y `quot` 2, optimising subtraction away.
-}</span><span>
</span><span id="line-671"></span><span>
</span><span id="line-672"></span><span class="hs-comment">{- Note [Inlining (^)
   ~~~~~~~~~~~~~~~~~~~~~
   The INLINABLE pragma allows (^) to be specialised at its call sites.
   If it is called repeatedly at the same type, that can make a huge
   difference, because of those constants which can be repeatedly
   calculated.

   Currently the fromInteger calls are not floated because we get
             \d1 d2 x y -&gt; blah
   after the gentle round of simplification. -}</span><span>
</span><span id="line-682"></span><span>
</span><span id="line-683"></span><span class="hs-comment">{- Rules for powers with known small exponent
    see #5237
    For small exponents, (^) is inefficient compared to manually
    expanding the multiplication tree.
    Here, rules for the most common exponent types are given.
    The range of exponents for which rules are given is quite
    arbitrary and kept small to not unduly increase the number of rules.
    0 and 1 are excluded based on the assumption that nobody would
    write x^0 or x^1 in code and the cases where an exponent could
    be statically resolved to 0 or 1 are rare.

    It might be desirable to have corresponding rules also for
    exponents of other types (e. g., Word), but it's doubtful they
    would fire, since the exponents of other types tend to get
    floated out before the rule has a chance to fire.

    Also desirable would be rules for (^^), but I haven't managed
    to get those to fire.

    Note: Trying to save multiplications by sharing the square for
    exponents 4 and 5 does not save time, indeed, for Double, it is
    up to twice slower, so the rules contain flat sequences of
    multiplications.
-}</span><span>
</span><span id="line-707"></span><span>
</span><span id="line-708"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-709"></span><span class="annot"><span class="hs-pragma">&quot;^2/Int&quot;</span></span><span>        </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679483075"><span class="annot"><a href="#local-6989586621679483075"><span class="hs-pragma hs-var">x</span></a></span></span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="#local-6989586621679483075"><span class="hs-pragma hs-type">x</span></a></span><span> </span><span class="annot"><a href="GHC.Real.html#%5E"><span class="hs-pragma hs-type">^</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><span class="hs-pragma">2</span></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-pragma hs-type">Int</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="hs-pragma">let</span><span> </span><span id="local-6989586621679483074"><span class="annot"><a href="#local-6989586621679483074"><span class="hs-pragma hs-var hs-var">u</span></a></span></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="#local-6989586621679483075"><span class="hs-pragma hs-type">x</span></a></span><span> </span><span class="hs-pragma">in</span><span> </span><span class="annot"><a href="#local-6989586621679483074"><span class="hs-pragma hs-type">u</span></a></span><span class="annot"><a href="GHC.Num.html#%2A"><span class="hs-pragma hs-type">*</span></a></span><span class="annot"><a href="#local-6989586621679483074"><span class="hs-pragma hs-type">u</span></a></span><span>
</span><span id="line-710"></span><span class="annot"><span class="hs-pragma">&quot;^3/Int&quot;</span></span><span>        </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679483073"><span class="annot"><a href="#local-6989586621679483073"><span class="hs-pragma hs-var">x</span></a></span></span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="#local-6989586621679483073"><span class="hs-pragma hs-type">x</span></a></span><span> </span><span class="annot"><a href="GHC.Real.html#%5E"><span class="hs-pragma hs-type">^</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><span class="hs-pragma">3</span></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-pragma hs-type">Int</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="hs-pragma">let</span><span> </span><span id="local-6989586621679483072"><span class="annot"><a href="#local-6989586621679483072"><span class="hs-pragma hs-var hs-var">u</span></a></span></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="#local-6989586621679483073"><span class="hs-pragma hs-type">x</span></a></span><span> </span><span class="hs-pragma">in</span><span> </span><span class="annot"><a href="#local-6989586621679483072"><span class="hs-pragma hs-type">u</span></a></span><span class="annot"><a href="GHC.Num.html#%2A"><span class="hs-pragma hs-type">*</span></a></span><span class="annot"><a href="#local-6989586621679483072"><span class="hs-pragma hs-type">u</span></a></span><span class="annot"><a href="GHC.Num.html#%2A"><span class="hs-pragma hs-type">*</span></a></span><span class="annot"><a href="#local-6989586621679483072"><span class="hs-pragma hs-type">u</span></a></span><span>
</span><span id="line-711"></span><span class="annot"><span class="hs-pragma">&quot;^4/Int&quot;</span></span><span>        </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679483071"><span class="annot"><a href="#local-6989586621679483071"><span class="hs-pragma hs-var">x</span></a></span></span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="#local-6989586621679483071"><span class="hs-pragma hs-type">x</span></a></span><span> </span><span class="annot"><a href="GHC.Real.html#%5E"><span class="hs-pragma hs-type">^</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><span class="hs-pragma">4</span></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-pragma hs-type">Int</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="hs-pragma">let</span><span> </span><span id="local-6989586621679483070"><span class="annot"><a href="#local-6989586621679483070"><span class="hs-pragma hs-var hs-var">u</span></a></span></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="#local-6989586621679483071"><span class="hs-pragma hs-type">x</span></a></span><span> </span><span class="hs-pragma">in</span><span> </span><span class="annot"><a href="#local-6989586621679483070"><span class="hs-pragma hs-type">u</span></a></span><span class="annot"><a href="GHC.Num.html#%2A"><span class="hs-pragma hs-type">*</span></a></span><span class="annot"><a href="#local-6989586621679483070"><span class="hs-pragma hs-type">u</span></a></span><span class="annot"><a href="GHC.Num.html#%2A"><span class="hs-pragma hs-type">*</span></a></span><span class="annot"><a href="#local-6989586621679483070"><span class="hs-pragma hs-type">u</span></a></span><span class="annot"><a href="GHC.Num.html#%2A"><span class="hs-pragma hs-type">*</span></a></span><span class="annot"><a href="#local-6989586621679483070"><span class="hs-pragma hs-type">u</span></a></span><span>
</span><span id="line-712"></span><span class="annot"><span class="hs-pragma">&quot;^5/Int&quot;</span></span><span>        </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679483069"><span class="annot"><a href="#local-6989586621679483069"><span class="hs-pragma hs-var">x</span></a></span></span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="#local-6989586621679483069"><span class="hs-pragma hs-type">x</span></a></span><span> </span><span class="annot"><a href="GHC.Real.html#%5E"><span class="hs-pragma hs-type">^</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><span class="hs-pragma">5</span></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-pragma hs-type">Int</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="hs-pragma">let</span><span> </span><span id="local-6989586621679483068"><span class="annot"><a href="#local-6989586621679483068"><span class="hs-pragma hs-var hs-var">u</span></a></span></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="#local-6989586621679483069"><span class="hs-pragma hs-type">x</span></a></span><span> </span><span class="hs-pragma">in</span><span> </span><span class="annot"><a href="#local-6989586621679483068"><span class="hs-pragma hs-type">u</span></a></span><span class="annot"><a href="GHC.Num.html#%2A"><span class="hs-pragma hs-type">*</span></a></span><span class="annot"><a href="#local-6989586621679483068"><span class="hs-pragma hs-type">u</span></a></span><span class="annot"><a href="GHC.Num.html#%2A"><span class="hs-pragma hs-type">*</span></a></span><span class="annot"><a href="#local-6989586621679483068"><span class="hs-pragma hs-type">u</span></a></span><span class="annot"><a href="GHC.Num.html#%2A"><span class="hs-pragma hs-type">*</span></a></span><span class="annot"><a href="#local-6989586621679483068"><span class="hs-pragma hs-type">u</span></a></span><span class="annot"><a href="GHC.Num.html#%2A"><span class="hs-pragma hs-type">*</span></a></span><span class="annot"><a href="#local-6989586621679483068"><span class="hs-pragma hs-type">u</span></a></span><span>
</span><span id="line-713"></span><span class="annot"><span class="hs-pragma">&quot;^2/Integer&quot;</span></span><span>    </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679483067"><span class="annot"><a href="#local-6989586621679483067"><span class="hs-pragma hs-var">x</span></a></span></span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="#local-6989586621679483067"><span class="hs-pragma hs-type">x</span></a></span><span> </span><span class="annot"><a href="GHC.Real.html#%5E"><span class="hs-pragma hs-type">^</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><span class="hs-pragma">2</span></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-pragma hs-type">Integer</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="hs-pragma">let</span><span> </span><span id="local-6989586621679483066"><span class="annot"><a href="#local-6989586621679483066"><span class="hs-pragma hs-var hs-var">u</span></a></span></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="#local-6989586621679483067"><span class="hs-pragma hs-type">x</span></a></span><span> </span><span class="hs-pragma">in</span><span> </span><span class="annot"><a href="#local-6989586621679483066"><span class="hs-pragma hs-type">u</span></a></span><span class="annot"><a href="GHC.Num.html#%2A"><span class="hs-pragma hs-type">*</span></a></span><span class="annot"><a href="#local-6989586621679483066"><span class="hs-pragma hs-type">u</span></a></span><span>
</span><span id="line-714"></span><span class="annot"><span class="hs-pragma">&quot;^3/Integer&quot;</span></span><span>    </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679483065"><span class="annot"><a href="#local-6989586621679483065"><span class="hs-pragma hs-var">x</span></a></span></span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="#local-6989586621679483065"><span class="hs-pragma hs-type">x</span></a></span><span> </span><span class="annot"><a href="GHC.Real.html#%5E"><span class="hs-pragma hs-type">^</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><span class="hs-pragma">3</span></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-pragma hs-type">Integer</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="hs-pragma">let</span><span> </span><span id="local-6989586621679483064"><span class="annot"><a href="#local-6989586621679483064"><span class="hs-pragma hs-var hs-var">u</span></a></span></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="#local-6989586621679483065"><span class="hs-pragma hs-type">x</span></a></span><span> </span><span class="hs-pragma">in</span><span> </span><span class="annot"><a href="#local-6989586621679483064"><span class="hs-pragma hs-type">u</span></a></span><span class="annot"><a href="GHC.Num.html#%2A"><span class="hs-pragma hs-type">*</span></a></span><span class="annot"><a href="#local-6989586621679483064"><span class="hs-pragma hs-type">u</span></a></span><span class="annot"><a href="GHC.Num.html#%2A"><span class="hs-pragma hs-type">*</span></a></span><span class="annot"><a href="#local-6989586621679483064"><span class="hs-pragma hs-type">u</span></a></span><span>
</span><span id="line-715"></span><span class="annot"><span class="hs-pragma">&quot;^4/Integer&quot;</span></span><span>    </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679483063"><span class="annot"><a href="#local-6989586621679483063"><span class="hs-pragma hs-var">x</span></a></span></span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="#local-6989586621679483063"><span class="hs-pragma hs-type">x</span></a></span><span> </span><span class="annot"><a href="GHC.Real.html#%5E"><span class="hs-pragma hs-type">^</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><span class="hs-pragma">4</span></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-pragma hs-type">Integer</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="hs-pragma">let</span><span> </span><span id="local-6989586621679483062"><span class="annot"><a href="#local-6989586621679483062"><span class="hs-pragma hs-var hs-var">u</span></a></span></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="#local-6989586621679483063"><span class="hs-pragma hs-type">x</span></a></span><span> </span><span class="hs-pragma">in</span><span> </span><span class="annot"><a href="#local-6989586621679483062"><span class="hs-pragma hs-type">u</span></a></span><span class="annot"><a href="GHC.Num.html#%2A"><span class="hs-pragma hs-type">*</span></a></span><span class="annot"><a href="#local-6989586621679483062"><span class="hs-pragma hs-type">u</span></a></span><span class="annot"><a href="GHC.Num.html#%2A"><span class="hs-pragma hs-type">*</span></a></span><span class="annot"><a href="#local-6989586621679483062"><span class="hs-pragma hs-type">u</span></a></span><span class="annot"><a href="GHC.Num.html#%2A"><span class="hs-pragma hs-type">*</span></a></span><span class="annot"><a href="#local-6989586621679483062"><span class="hs-pragma hs-type">u</span></a></span><span>
</span><span id="line-716"></span><span class="annot"><span class="hs-pragma">&quot;^5/Integer&quot;</span></span><span>    </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679483061"><span class="annot"><a href="#local-6989586621679483061"><span class="hs-pragma hs-var">x</span></a></span></span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="#local-6989586621679483061"><span class="hs-pragma hs-type">x</span></a></span><span> </span><span class="annot"><a href="GHC.Real.html#%5E"><span class="hs-pragma hs-type">^</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><span class="hs-pragma">5</span></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-pragma hs-type">Integer</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="hs-pragma">let</span><span> </span><span id="local-6989586621679483060"><span class="annot"><a href="#local-6989586621679483060"><span class="hs-pragma hs-var hs-var">u</span></a></span></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="#local-6989586621679483061"><span class="hs-pragma hs-type">x</span></a></span><span> </span><span class="hs-pragma">in</span><span> </span><span class="annot"><a href="#local-6989586621679483060"><span class="hs-pragma hs-type">u</span></a></span><span class="annot"><a href="GHC.Num.html#%2A"><span class="hs-pragma hs-type">*</span></a></span><span class="annot"><a href="#local-6989586621679483060"><span class="hs-pragma hs-type">u</span></a></span><span class="annot"><a href="GHC.Num.html#%2A"><span class="hs-pragma hs-type">*</span></a></span><span class="annot"><a href="#local-6989586621679483060"><span class="hs-pragma hs-type">u</span></a></span><span class="annot"><a href="GHC.Num.html#%2A"><span class="hs-pragma hs-type">*</span></a></span><span class="annot"><a href="#local-6989586621679483060"><span class="hs-pragma hs-type">u</span></a></span><span class="annot"><a href="GHC.Num.html#%2A"><span class="hs-pragma hs-type">*</span></a></span><span class="annot"><a href="#local-6989586621679483060"><span class="hs-pragma hs-type">u</span></a></span><span>
</span><span id="line-717"></span><span>  </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-718"></span><span>
</span><span id="line-719"></span><span class="hs-comment">-------------------------------------------------------</span><span>
</span><span id="line-720"></span><span class="hs-comment">-- Special power functions for Rational</span><span>
</span><span id="line-721"></span><span class="hs-comment">--</span><span>
</span><span id="line-722"></span><span class="hs-comment">-- see #4337</span><span>
</span><span id="line-723"></span><span class="hs-comment">--</span><span>
</span><span id="line-724"></span><span class="hs-comment">-- Rationale:</span><span>
</span><span id="line-725"></span><span class="hs-comment">-- For a legitimate Rational (n :% d), the numerator and denominator are</span><span>
</span><span id="line-726"></span><span class="hs-comment">-- coprime, i.e. they have no common prime factor.</span><span>
</span><span id="line-727"></span><span class="hs-comment">-- Therefore all powers (n ^ a) and (d ^ b) are also coprime, so it is</span><span>
</span><span id="line-728"></span><span class="hs-comment">-- not necessary to compute the greatest common divisor, which would be</span><span>
</span><span id="line-729"></span><span class="hs-comment">-- done in the default implementation at each multiplication step.</span><span>
</span><span id="line-730"></span><span class="hs-comment">-- Since exponentiation quickly leads to very large numbers and</span><span>
</span><span id="line-731"></span><span class="hs-comment">-- calculation of gcds is generally very slow for large numbers,</span><span>
</span><span id="line-732"></span><span class="hs-comment">-- avoiding the gcd leads to an order of magnitude speedup relatively</span><span>
</span><span id="line-733"></span><span class="hs-comment">-- soon (and an asymptotic improvement overall).</span><span>
</span><span id="line-734"></span><span class="hs-comment">--</span><span>
</span><span id="line-735"></span><span class="hs-comment">-- Note:</span><span>
</span><span id="line-736"></span><span class="hs-comment">-- We cannot use these functions for general Ratio a because that would</span><span>
</span><span id="line-737"></span><span class="hs-comment">-- change results in a multitude of cases.</span><span>
</span><span id="line-738"></span><span class="hs-comment">-- The cause is that if a and b are coprime, their remainders by any</span><span>
</span><span id="line-739"></span><span class="hs-comment">-- positive modulus generally aren't, so in the default implementation</span><span>
</span><span id="line-740"></span><span class="hs-comment">-- reduction occurs.</span><span>
</span><span id="line-741"></span><span class="hs-comment">--</span><span>
</span><span id="line-742"></span><span class="hs-comment">-- Example:</span><span>
</span><span id="line-743"></span><span class="hs-comment">-- (17 % 3) ^ 3 :: Ratio Word8</span><span>
</span><span id="line-744"></span><span class="hs-comment">-- Default:</span><span>
</span><span id="line-745"></span><span class="hs-comment">-- (17 % 3) ^ 3 = ((17 % 3) ^ 2) * (17 % 3)</span><span>
</span><span id="line-746"></span><span class="hs-comment">--              = ((289 `mod` 256) % 9) * (17 % 3)</span><span>
</span><span id="line-747"></span><span class="hs-comment">--              = (33 % 9) * (17 % 3)</span><span>
</span><span id="line-748"></span><span class="hs-comment">--              = (11 % 3) * (17 % 3)</span><span>
</span><span id="line-749"></span><span class="hs-comment">--              = (187 % 9)</span><span>
</span><span id="line-750"></span><span class="hs-comment">-- But:</span><span>
</span><span id="line-751"></span><span class="hs-comment">-- ((17^3) `mod` 256) % (3^3)   = (4913 `mod` 256) % 27</span><span>
</span><span id="line-752"></span><span class="hs-comment">--                              = 49 % 27</span><span>
</span><span id="line-753"></span><span class="hs-comment">--</span><span>
</span><span id="line-754"></span><span class="hs-comment">-- TODO:</span><span>
</span><span id="line-755"></span><span class="hs-comment">-- Find out whether special-casing for numerator, denominator or</span><span>
</span><span id="line-756"></span><span class="hs-comment">-- exponent = 1 (or -1, where that may apply) gains something.</span><span>
</span><span id="line-757"></span><span>
</span><span id="line-758"></span><span class="hs-comment">-- Special version of (^) for Rational base</span><span>
</span><span id="line-759"></span><span class="hs-pragma">{-# RULES</span><span> </span><span class="annot"><span class="hs-pragma">&quot;(^)/Rational&quot;</span></span><span>    </span><span class="hs-pragma">(</span><span class="hs-pragma">^</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">^%^</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-760"></span><span id="local-6989586621679484055"><span class="annot"><a href="GHC.Real.html#%5E%25%5E"><span class="hs-operator hs-type">(^%^)</span></a></span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Real.html#Integral"><span class="hs-identifier hs-type">Integral</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484055"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Real.html#Rational"><span class="hs-identifier hs-type">Rational</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484055"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Real.html#Rational"><span class="hs-identifier hs-type">Rational</span></a></span></span><span>
</span><span id="line-761"></span><span class="hs-special">(</span><span id="local-6989586621679483043"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483043"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="annot"><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-type">:%</span></a></span><span> </span><span id="local-6989586621679483042"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483042"><span class="hs-identifier hs-var">d</span></a></span></span><span class="hs-special">)</span><span> </span><span id="%5E%25%5E"><span class="annot"><span class="annottext">^%^ :: forall a. Integral a =&gt; Rational -&gt; a -&gt; Rational
</span><a href="GHC.Real.html#%5E%25%5E"><span class="hs-operator hs-var hs-var">^%^</span></a></span></span><span> </span><span id="local-6989586621679483041"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483041"><span class="hs-identifier hs-var">e</span></a></span></span><span>
</span><span id="line-762"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483041"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">0</span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; Rational
forall a. [Char] -&gt; a
</span><a href="GHC.Err.html#errorWithoutStackTrace"><span class="hs-identifier hs-var">errorWithoutStackTrace</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;Negative exponent&quot;</span></span><span>
</span><span id="line-763"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483041"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">0</span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Rational
forall a. a -&gt; a -&gt; Ratio a
</span><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-var">:%</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">1</span></span><span>
</span><span id="line-764"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483043"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; a -&gt; Integer
forall a b. (Num a, Integral b) =&gt; a -&gt; b -&gt; a
</span><a href="GHC.Real.html#%5E"><span class="hs-operator hs-var">^</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483041"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Rational
forall a. a -&gt; a -&gt; Ratio a
</span><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-var">:%</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483042"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; a -&gt; Integer
forall a b. (Num a, Integral b) =&gt; a -&gt; b -&gt; a
</span><a href="GHC.Real.html#%5E"><span class="hs-operator hs-var">^</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483041"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-765"></span><span>
</span><span id="line-766"></span><span class="hs-comment">-- Special version of (^^) for Rational base</span><span>
</span><span id="line-767"></span><span class="hs-pragma">{-# RULES</span><span> </span><span class="annot"><span class="hs-pragma">&quot;(^^)/Rational&quot;</span></span><span>   </span><span class="hs-pragma">(</span><span class="hs-pragma">^^</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">^^%^^</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-768"></span><span id="local-6989586621679483039"><span class="annot"><a href="GHC.Real.html#%5E%5E%25%5E%5E"><span class="hs-operator hs-type">(^^%^^)</span></a></span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Real.html#Integral"><span class="hs-identifier hs-type">Integral</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679483039"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Real.html#Rational"><span class="hs-identifier hs-type">Rational</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679483039"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Real.html#Rational"><span class="hs-identifier hs-type">Rational</span></a></span></span><span>
</span><span id="line-769"></span><span class="hs-special">(</span><span id="local-6989586621679483011"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483011"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="annot"><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-type">:%</span></a></span><span> </span><span id="local-6989586621679483010"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483010"><span class="hs-identifier hs-var">d</span></a></span></span><span class="hs-special">)</span><span> </span><span id="%5E%5E%25%5E%5E"><span class="annot"><span class="annottext">^^%^^ :: forall a. Integral a =&gt; Rational -&gt; a -&gt; Rational
</span><a href="GHC.Real.html#%5E%5E%25%5E%5E"><span class="hs-operator hs-var hs-var">^^%^^</span></a></span></span><span> </span><span id="local-6989586621679483009"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483009"><span class="hs-identifier hs-var">e</span></a></span></span><span>
</span><span id="line-770"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483009"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E"><span class="hs-operator hs-var">&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">0</span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483011"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; a -&gt; Integer
forall a b. (Num a, Integral b) =&gt; a -&gt; b -&gt; a
</span><a href="GHC.Real.html#%5E"><span class="hs-operator hs-var">^</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483009"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Rational
forall a. a -&gt; a -&gt; Ratio a
</span><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-var">:%</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483010"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; a -&gt; Integer
forall a b. (Num a, Integral b) =&gt; a -&gt; b -&gt; a
</span><a href="GHC.Real.html#%5E"><span class="hs-operator hs-var">^</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483009"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-771"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483009"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">0</span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Rational
forall a. a -&gt; a -&gt; Ratio a
</span><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-var">:%</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">1</span></span><span>
</span><span id="line-772"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483011"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E"><span class="hs-operator hs-var">&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">0</span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483010"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; a -&gt; Integer
forall a b. (Num a, Integral b) =&gt; a -&gt; b -&gt; a
</span><a href="GHC.Real.html#%5E"><span class="hs-operator hs-var">^</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; a
forall a. Num a =&gt; a -&gt; a
</span><a href="GHC.Num.html#negate"><span class="hs-identifier hs-var">negate</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483009"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Rational
forall a. a -&gt; a -&gt; Ratio a
</span><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-var">:%</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483011"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; a -&gt; Integer
forall a b. (Num a, Integral b) =&gt; a -&gt; b -&gt; a
</span><a href="GHC.Real.html#%5E"><span class="hs-operator hs-var">^</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; a
forall a. Num a =&gt; a -&gt; a
</span><a href="GHC.Num.html#negate"><span class="hs-identifier hs-var">negate</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483009"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-773"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483011"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">0</span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Rational
forall a. a
</span><a href="GHC.Real.html#ratioZeroDenominatorError"><span class="hs-identifier hs-var">ratioZeroDenominatorError</span></a></span><span>
</span><span id="line-774"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679483005"><span class="annot"><span class="annottext">nn :: Integer
</span><a href="#local-6989586621679483005"><span class="hs-identifier hs-var hs-var">nn</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483010"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; a -&gt; Integer
forall a b. (Num a, Integral b) =&gt; a -&gt; b -&gt; a
</span><a href="GHC.Real.html#%5E"><span class="hs-operator hs-var">^</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; a
forall a. Num a =&gt; a -&gt; a
</span><a href="GHC.Num.html#negate"><span class="hs-identifier hs-var">negate</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483009"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-775"></span><span>                      </span><span id="local-6989586621679483000"><span class="annot"><span class="annottext">dd :: Integer
</span><a href="#local-6989586621679483000"><span class="hs-identifier hs-var hs-var">dd</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a
</span><a href="GHC.Num.html#negate"><span class="hs-identifier hs-var">negate</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483011"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; a -&gt; Integer
forall a b. (Num a, Integral b) =&gt; a -&gt; b -&gt; a
</span><a href="GHC.Real.html#%5E"><span class="hs-operator hs-var">^</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; a
forall a. Num a =&gt; a -&gt; a
</span><a href="GHC.Num.html#negate"><span class="hs-identifier hs-var">negate</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483009"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-776"></span><span>                  </span><span class="hs-keyword">in</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
forall a. Integral a =&gt; a -&gt; Bool
</span><a href="GHC.Real.html#even"><span class="hs-identifier hs-var">even</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679483009"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483005"><span class="hs-identifier hs-var">nn</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Rational
forall a. a -&gt; a -&gt; Ratio a
</span><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-var">:%</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483000"><span class="hs-identifier hs-var">dd</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">else</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a
</span><a href="GHC.Num.html#negate"><span class="hs-identifier hs-var">negate</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483005"><span class="hs-identifier hs-var">nn</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Rational
forall a. a -&gt; a -&gt; Ratio a
</span><a href="GHC.Real.html#%3A%25"><span class="hs-operator hs-var">:%</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679483000"><span class="hs-identifier hs-var">dd</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-777"></span><span>
</span><span id="line-778"></span><span class="hs-comment">-------------------------------------------------------</span><span>
</span><span id="line-779"></span><span class="hs-comment">-- | @'gcd' x y@ is the non-negative factor of both @x@ and @y@ of which</span><span>
</span><span id="line-780"></span><span class="hs-comment">-- every common factor of @x@ and @y@ is also a factor; for example</span><span>
</span><span id="line-781"></span><span class="hs-comment">-- @'gcd' 4 2 = 2@, @'gcd' (-4) 6 = 2@, @'gcd' 0 4@ = @4@. @'gcd' 0 0@ = @0@.</span><span>
</span><span id="line-782"></span><span class="hs-comment">-- (That is, the common divisor that is \&quot;greatest\&quot; in the divisibility</span><span>
</span><span id="line-783"></span><span class="hs-comment">-- preordering.)</span><span>
</span><span id="line-784"></span><span class="hs-comment">--</span><span>
</span><span id="line-785"></span><span class="hs-comment">-- Note: Since for signed fixed-width integer types, @'abs' 'minBound' &lt; 0@,</span><span>
</span><span id="line-786"></span><span class="hs-comment">-- the result may be negative if one of the arguments is @'minBound'@ (and</span><span>
</span><span id="line-787"></span><span class="hs-comment">-- necessarily is if the other is @0@ or @'minBound'@) for such types.</span><span>
</span><span id="line-788"></span><span id="local-6989586621679482999"><span class="annot"><a href="GHC.Real.html#gcd"><span class="hs-identifier hs-type">gcd</span></a></span><span>             </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Real.html#Integral"><span class="hs-identifier hs-type">Integral</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679482999"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679482999"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679482999"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679482999"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-789"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.Real.html#gcd"><span class="hs-pragma hs-type">gcd</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-790"></span><span id="gcd"><span class="annot"><span class="annottext">gcd :: forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Real.html#gcd"><span class="hs-identifier hs-var hs-var">gcd</span></a></span></span><span> </span><span id="local-6989586621679482992"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679482992"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679482991"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679482991"><span class="hs-identifier hs-var">y</span></a></span></span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679482990"><span class="hs-identifier hs-var">gcd'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; a
forall a. Num a =&gt; a -&gt; a
</span><a href="GHC.Num.html#abs"><span class="hs-identifier hs-var">abs</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679482992"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; a
forall a. Num a =&gt; a -&gt; a
</span><a href="GHC.Num.html#abs"><span class="hs-identifier hs-var">abs</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679482991"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-791"></span><span>                   </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679482990"><span class="annot"><span class="annottext">gcd' :: t -&gt; t -&gt; t
</span><a href="#local-6989586621679482990"><span class="hs-identifier hs-var hs-var">gcd'</span></a></span></span><span> </span><span id="local-6989586621679482981"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679482981"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="annot"><span class="annottext">t
</span><span class="hs-number">0</span></span><span>  </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679482981"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-792"></span><span>                         </span><span class="annot"><a href="#local-6989586621679482990"><span class="hs-identifier hs-var">gcd'</span></a></span><span> </span><span id="local-6989586621679482980"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679482980"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679482979"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679482979"><span class="hs-identifier hs-var">b</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">t -&gt; t -&gt; t
</span><a href="#local-6989586621679482990"><span class="hs-identifier hs-var">gcd'</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679482979"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679482980"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">t -&gt; t -&gt; t
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Real.html#rem"><span class="hs-operator hs-var">`rem`</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679482979"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-793"></span><span>
</span><span id="line-794"></span><span class="hs-comment">-- | @'lcm' x y@ is the smallest positive integer that both @x@ and @y@ divide.</span><span>
</span><span id="line-795"></span><span id="local-6989586621679482978"><span class="annot"><a href="GHC.Real.html#lcm"><span class="hs-identifier hs-type">lcm</span></a></span><span>             </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Real.html#Integral"><span class="hs-identifier hs-type">Integral</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679482978"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679482978"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679482978"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679482978"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-796"></span><span class="hs-pragma">{-# SPECIALISE</span><span> </span><span class="annot"><a href="GHC.Real.html#lcm"><span class="hs-pragma hs-type">lcm</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-pragma hs-type">Int</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-pragma hs-type">Int</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-pragma hs-type">Int</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-797"></span><span class="hs-pragma">{-# SPECIALISE</span><span> </span><span class="annot"><a href="GHC.Real.html#lcm"><span class="hs-pragma hs-type">lcm</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Word"><span class="hs-pragma hs-type">Word</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Word"><span class="hs-pragma hs-type">Word</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Word"><span class="hs-pragma hs-type">Word</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-798"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.Real.html#lcm"><span class="hs-pragma hs-type">lcm</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-799"></span><span id="lcm"><span class="annot"><span class="annottext">lcm :: forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Real.html#lcm"><span class="hs-identifier hs-var hs-var">lcm</span></a></span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">0</span></span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">0</span></span><span>
</span><span id="line-800"></span><span class="annot"><a href="GHC.Real.html#lcm"><span class="hs-identifier hs-var">lcm</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">0</span></span><span>
</span><span id="line-801"></span><span class="annot"><a href="GHC.Real.html#lcm"><span class="hs-identifier hs-var">lcm</span></a></span><span> </span><span id="local-6989586621679482961"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679482961"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679482960"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679482960"><span class="hs-identifier hs-var">y</span></a></span></span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">a -&gt; a
forall a. Num a =&gt; a -&gt; a
</span><a href="GHC.Num.html#abs"><span class="hs-identifier hs-var">abs</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679482961"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Real.html#quot"><span class="hs-operator hs-var">`quot`</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Real.html#gcd"><span class="hs-identifier hs-var">gcd</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679482961"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679482960"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679482960"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-802"></span><span>
</span><span id="line-803"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-804"></span><span class="annot"><span class="hs-pragma">&quot;gcd/Integer-&gt;Integer-&gt;Integer&quot;</span></span><span> </span><span class="annot"><a href="GHC.Real.html#gcd"><span class="hs-pragma hs-type">gcd</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerGcd"><span class="hs-pragma hs-type">integerGcd</span></a></span><span>
</span><span id="line-805"></span><span class="annot"><span class="hs-pragma">&quot;lcm/Integer-&gt;Integer-&gt;Integer&quot;</span></span><span> </span><span class="annot"><a href="GHC.Real.html#lcm"><span class="hs-pragma hs-type">lcm</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerLcm"><span class="hs-pragma hs-type">integerLcm</span></a></span><span>
</span><span id="line-806"></span><span class="annot"><span class="hs-pragma">&quot;gcd/Natural-&gt;Natural-&gt;Natural&quot;</span></span><span> </span><span class="annot"><a href="GHC.Real.html#gcd"><span class="hs-pragma hs-type">gcd</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Natural.html#naturalGcd"><span class="hs-pragma hs-type">naturalGcd</span></a></span><span>
</span><span id="line-807"></span><span class="annot"><span class="hs-pragma">&quot;lcm/Natural-&gt;Natural-&gt;Natural&quot;</span></span><span> </span><span class="annot"><a href="GHC.Real.html#lcm"><span class="hs-pragma hs-type">lcm</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Natural.html#naturalLcm"><span class="hs-pragma hs-type">naturalLcm</span></a></span><span>
</span><span id="line-808"></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-809"></span><span>
</span><span id="line-810"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-811"></span><span class="annot"><span class="hs-pragma">&quot;gcd/Int-&gt;Int-&gt;Int&quot;</span></span><span>             </span><span class="annot"><a href="GHC.Real.html#gcd"><span class="hs-pragma hs-type">gcd</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.BigNat.html#gcdInt"><span class="hs-pragma hs-type">gcdInt</span></a></span><span>
</span><span id="line-812"></span><span class="annot"><span class="hs-pragma">&quot;gcd/Word-&gt;Word-&gt;Word&quot;</span></span><span>          </span><span class="annot"><a href="GHC.Real.html#gcd"><span class="hs-pragma hs-type">gcd</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.BigNat.html#gcdWord"><span class="hs-pragma hs-type">gcdWord</span></a></span><span>
</span><span id="line-813"></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-814"></span><span>
</span><span id="line-815"></span><span class="hs-comment">-- See Note [Stable Unfolding for list producers] in GHC.Enum</span><span>
</span><span id="line-816"></span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="GHC.Real.html#integralEnumFrom"><span class="hs-pragma hs-type">integralEnumFrom</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-817"></span><span id="local-6989586621679484049"><span class="annot"><a href="GHC.Real.html#integralEnumFrom"><span class="hs-identifier hs-type">integralEnumFrom</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Real.html#Integral"><span class="hs-identifier hs-type">Integral</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484049"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Enum.html#Bounded"><span class="hs-identifier hs-type">Bounded</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484049"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484049"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679484049"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-818"></span><span id="integralEnumFrom"><span class="annot"><span class="annottext">integralEnumFrom :: forall a. (Integral a, Bounded a) =&gt; a -&gt; [a]
</span><a href="GHC.Real.html#integralEnumFrom"><span class="hs-identifier hs-var hs-var">integralEnumFrom</span></a></span></span><span> </span><span id="local-6989586621679482949"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679482949"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Integer -&gt; a) -&gt; [Integer] -&gt; [a]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; a
forall a. Num a =&gt; Integer -&gt; a
</span><a href="GHC.Num.html#fromInteger"><span class="hs-identifier hs-var">fromInteger</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">a -&gt; Integer
forall a. Integral a =&gt; a -&gt; Integer
</span><a href="GHC.Real.html#toInteger"><span class="hs-identifier hs-var">toInteger</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679482949"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="hs-glyph">..</span><span> </span><span class="annot"><span class="annottext">a -&gt; Integer
forall a. Integral a =&gt; a -&gt; Integer
</span><a href="GHC.Real.html#toInteger"><span class="hs-identifier hs-var">toInteger</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
forall a. Bounded a =&gt; a
</span><a href="GHC.Enum.html#maxBound"><span class="hs-identifier hs-var">maxBound</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. a -&gt; a -&gt; a
</span><a href="GHC.Base.html#asTypeOf"><span class="hs-operator hs-var">`asTypeOf`</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679482949"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-819"></span><span>
</span><span id="line-820"></span><span class="hs-comment">-- See Note [Stable Unfolding for list producers] in GHC.Enum</span><span>
</span><span id="line-821"></span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="GHC.Real.html#integralEnumFromThen"><span class="hs-pragma hs-type">integralEnumFromThen</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-822"></span><span id="local-6989586621679484044"><span class="annot"><a href="GHC.Real.html#integralEnumFromThen"><span class="hs-identifier hs-type">integralEnumFromThen</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Real.html#Integral"><span class="hs-identifier hs-type">Integral</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484044"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Enum.html#Bounded"><span class="hs-identifier hs-type">Bounded</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484044"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484044"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484044"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679484044"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-823"></span><span id="integralEnumFromThen"><span class="annot"><span class="annottext">integralEnumFromThen :: forall a. (Integral a, Bounded a) =&gt; a -&gt; a -&gt; [a]
</span><a href="GHC.Real.html#integralEnumFromThen"><span class="hs-identifier hs-var hs-var">integralEnumFromThen</span></a></span></span><span> </span><span id="local-6989586621679482932"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679482932"><span class="hs-identifier hs-var">n1</span></a></span></span><span> </span><span id="local-6989586621679482931"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679482931"><span class="hs-identifier hs-var">n2</span></a></span></span><span>
</span><span id="line-824"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679482930"><span class="hs-identifier hs-var">i_n2</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679482929"><span class="hs-identifier hs-var">i_n1</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Integer -&gt; a) -&gt; [Integer] -&gt; [a]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; a
forall a. Num a =&gt; Integer -&gt; a
</span><a href="GHC.Num.html#fromInteger"><span class="hs-identifier hs-var">fromInteger</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679482929"><span class="hs-identifier hs-var">i_n1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679482930"><span class="hs-identifier hs-var">i_n2</span></a></span><span> </span><span class="hs-glyph">..</span><span> </span><span class="annot"><span class="annottext">a -&gt; Integer
forall a. Integral a =&gt; a -&gt; Integer
</span><a href="GHC.Real.html#toInteger"><span class="hs-identifier hs-var">toInteger</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
forall a. Bounded a =&gt; a
</span><a href="GHC.Enum.html#maxBound"><span class="hs-identifier hs-var">maxBound</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. a -&gt; a -&gt; a
</span><a href="GHC.Base.html#asTypeOf"><span class="hs-operator hs-var">`asTypeOf`</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679482932"><span class="hs-identifier hs-var">n1</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-825"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Integer -&gt; a) -&gt; [Integer] -&gt; [a]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; a
forall a. Num a =&gt; Integer -&gt; a
</span><a href="GHC.Num.html#fromInteger"><span class="hs-identifier hs-var">fromInteger</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679482929"><span class="hs-identifier hs-var">i_n1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679482930"><span class="hs-identifier hs-var">i_n2</span></a></span><span> </span><span class="hs-glyph">..</span><span> </span><span class="annot"><span class="annottext">a -&gt; Integer
forall a. Integral a =&gt; a -&gt; Integer
</span><a href="GHC.Real.html#toInteger"><span class="hs-identifier hs-var">toInteger</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
forall a. Bounded a =&gt; a
</span><a href="GHC.Enum.html#minBound"><span class="hs-identifier hs-var">minBound</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. a -&gt; a -&gt; a
</span><a href="GHC.Base.html#asTypeOf"><span class="hs-operator hs-var">`asTypeOf`</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679482932"><span class="hs-identifier hs-var">n1</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-826"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-827"></span><span>    </span><span id="local-6989586621679482929"><span class="annot"><span class="annottext">i_n1 :: Integer
</span><a href="#local-6989586621679482929"><span class="hs-identifier hs-var hs-var">i_n1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Integer
forall a. Integral a =&gt; a -&gt; Integer
</span><a href="GHC.Real.html#toInteger"><span class="hs-identifier hs-var">toInteger</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679482932"><span class="hs-identifier hs-var">n1</span></a></span><span>
</span><span id="line-828"></span><span>    </span><span id="local-6989586621679482930"><span class="annot"><span class="annottext">i_n2 :: Integer
</span><a href="#local-6989586621679482930"><span class="hs-identifier hs-var hs-var">i_n2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Integer
forall a. Integral a =&gt; a -&gt; Integer
</span><a href="GHC.Real.html#toInteger"><span class="hs-identifier hs-var">toInteger</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679482931"><span class="hs-identifier hs-var">n2</span></a></span><span>
</span><span id="line-829"></span><span>
</span><span id="line-830"></span><span class="hs-comment">-- See Note [Stable Unfolding for list producers] in GHC.Enum</span><span>
</span><span id="line-831"></span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="GHC.Real.html#integralEnumFromTo"><span class="hs-pragma hs-type">integralEnumFromTo</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-832"></span><span id="local-6989586621679484042"><span class="annot"><a href="GHC.Real.html#integralEnumFromTo"><span class="hs-identifier hs-type">integralEnumFromTo</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Real.html#Integral"><span class="hs-identifier hs-type">Integral</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484042"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484042"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484042"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679484042"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-833"></span><span id="integralEnumFromTo"><span class="annot"><span class="annottext">integralEnumFromTo :: forall a. Integral a =&gt; a -&gt; a -&gt; [a]
</span><a href="GHC.Real.html#integralEnumFromTo"><span class="hs-identifier hs-var hs-var">integralEnumFromTo</span></a></span></span><span> </span><span id="local-6989586621679482918"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679482918"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679482917"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679482917"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Integer -&gt; a) -&gt; [Integer] -&gt; [a]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; a
forall a. Num a =&gt; Integer -&gt; a
</span><a href="GHC.Num.html#fromInteger"><span class="hs-identifier hs-var">fromInteger</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">a -&gt; Integer
forall a. Integral a =&gt; a -&gt; Integer
</span><a href="GHC.Real.html#toInteger"><span class="hs-identifier hs-var">toInteger</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679482918"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="hs-glyph">..</span><span> </span><span class="annot"><span class="annottext">a -&gt; Integer
forall a. Integral a =&gt; a -&gt; Integer
</span><a href="GHC.Real.html#toInteger"><span class="hs-identifier hs-var">toInteger</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679482917"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-834"></span><span>
</span><span id="line-835"></span><span class="hs-comment">-- See Note [Stable Unfolding for list producers] in GHC.Enum</span><span>
</span><span id="line-836"></span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="GHC.Real.html#integralEnumFromThenTo"><span class="hs-pragma hs-type">integralEnumFromThenTo</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-837"></span><span id="local-6989586621679484040"><span class="annot"><a href="GHC.Real.html#integralEnumFromThenTo"><span class="hs-identifier hs-type">integralEnumFromThenTo</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Real.html#Integral"><span class="hs-identifier hs-type">Integral</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679484040"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484040"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484040"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679484040"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679484040"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-838"></span><span id="integralEnumFromThenTo"><span class="annot"><span class="annottext">integralEnumFromThenTo :: forall a. Integral a =&gt; a -&gt; a -&gt; a -&gt; [a]
</span><a href="GHC.Real.html#integralEnumFromThenTo"><span class="hs-identifier hs-var hs-var">integralEnumFromThenTo</span></a></span></span><span> </span><span id="local-6989586621679482907"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679482907"><span class="hs-identifier hs-var">n1</span></a></span></span><span> </span><span id="local-6989586621679482906"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679482906"><span class="hs-identifier hs-var">n2</span></a></span></span><span> </span><span id="local-6989586621679482905"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679482905"><span class="hs-identifier hs-var">m</span></a></span></span><span>
</span><span id="line-839"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Integer -&gt; a) -&gt; [Integer] -&gt; [a]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; a
forall a. Num a =&gt; Integer -&gt; a
</span><a href="GHC.Num.html#fromInteger"><span class="hs-identifier hs-var">fromInteger</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">a -&gt; Integer
forall a. Integral a =&gt; a -&gt; Integer
</span><a href="GHC.Real.html#toInteger"><span class="hs-identifier hs-var">toInteger</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679482907"><span class="hs-identifier hs-var">n1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">a -&gt; Integer
forall a. Integral a =&gt; a -&gt; Integer
</span><a href="GHC.Real.html#toInteger"><span class="hs-identifier hs-var">toInteger</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679482906"><span class="hs-identifier hs-var">n2</span></a></span><span> </span><span class="hs-glyph">..</span><span> </span><span class="annot"><span class="annottext">a -&gt; Integer
forall a. Integral a =&gt; a -&gt; Integer
</span><a href="GHC.Real.html#toInteger"><span class="hs-identifier hs-var">toInteger</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679482905"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-840"></span></pre></body></html>